/* ============================================================
   工具站共享样式 - www.lifeincode.cn
   移动端优先，Element Plus 增强
   ============================================================ */
:root {
  --primary: #409EFF;
  --primary-dark: #337ecc;
  --primary-rgb: 64, 158, 255;
  --primary-light: rgba(var(--primary-rgb), 0.1);
  --success: #67C23A;
  --danger: #F56C6C;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #303133;
  --text-sub: #909399;
  --muted: #909399;
  --border: #e4e7ed;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --footer-bg: #f0f2f5;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ---------- 顶部导航 ---------- */
.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
}
.site-header.hide {
  transform: translateY(-100%);
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo .icon { font-size: 24px; }
.logo a { color: var(--text); }
.nav-desktop { display: none; align-items: center; }
.nav-link { padding: 6px 10px; font-size: 14px; color: var(--text-sub); }
.nav-link.active { color: var(--primary); font-weight: 600; }

/* ---------- 顶栏分类下拉（悬停展开，直达任意工具） ---------- */
.nav-item { position: relative; }
.nav-link.has-drop::after {
  content: '';
  display: inline-block;
  margin-left: 4px;
  vertical-align: 2px;
  border: 4px solid transparent;
  border-top-color: currentColor;
  opacity: 0.6;
}
.nav-drop {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 10px);
  min-width: 190px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(48, 49, 51, 0.14);
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 200;
}
.nav-drop.cols-2 { grid-template-columns: 1fr 1fr; min-width: 340px; }
.nav-item:hover .nav-drop,
.nav-item:focus-within .nav-drop,
.nav-item.open .nav-drop {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 4px);
}
.nav-drop a {
  display: block;
  padding: 7px 12px;
  font-size: 13.5px;
  color: var(--text);
  border-radius: 8px;
  white-space: nowrap;
}
.nav-drop a:hover { background: rgba(var(--primary-rgb), 0.08); color: var(--primary); }
.nav-item:hover .nav-link.has-drop { color: var(--primary); }

/* ---------- 顶栏搜索 ---------- */
.nav-search {
  display: none;
  align-items: center;
  position: relative;
  margin-left: 8px;
}
.nav-search svg {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--text-sub);
  pointer-events: none;
}
.nav-search input {
  width: 150px;
  padding: 7px 12px 7px 32px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  transition: width 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.nav-search input::-webkit-search-cancel-button { display: none; }
.nav-search input:focus {
  width: 210px;
  background: #fff;
  border-color: var(--primary);
}

/* ---------- 容器 ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 16px; }
.container-wide { max-width: 1280px; margin: 0 auto; padding: 16px; }

/* ---------- 首页 Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 44px 20px 34px;
  margin-top: 4px;
  background:
    radial-gradient(600px 220px at 12% -10%, rgba(var(--primary-rgb), 0.16), transparent 60%),
    radial-gradient(520px 240px at 88% 115%, rgba(255, 176, 32, 0.10), transparent 60%),
    linear-gradient(160deg, var(--hero-a, #f0f7ff) 0%, var(--hero-b, #f8fbff) 60%, #fffdf7 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.hero h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.hero p {
  color: var(--text-sub);
  font-size: 15px;
  line-height: 1.8;
  max-width: 620px;
  margin: 0 auto;
}
@media (max-width: 640px) {
  .hero { padding: 30px 14px 26px; border-radius: 12px; }
  .hero h1 { font-size: 21px; }
  .hero p { font-size: 13.5px; }
}

/* ---------- 搜索框 ---------- */
.search-wrap { max-width: 620px; margin: 24px auto 0; position: relative; z-index: 1; }
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px 4px 18px;
  box-shadow: 0 6px 24px rgba(48, 49, 51, 0.06);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 8px 28px rgba(var(--primary-rgb), 0.20);
}
.sb-icon { flex: none; width: 19px; height: 19px; color: var(--text-sub); }
.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  padding: 11px 0;
  color: var(--text);
}
.search-box input::-webkit-search-cancel-button { display: none; }
.sb-clear {
  flex: none;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #f0f2f5;
  color: var(--text-sub);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}
.sb-clear:hover { background: var(--border); color: var(--text); }
.search-box.has-value .sb-clear { display: flex; }
.hot-keys {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-sub);
}
.hot-keys a {
  color: var(--text-sub);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  padding: 3px 12px;
  border-radius: 999px;
  transition: all 0.2s ease;
}
.hot-keys a:hover { color: var(--primary); border-color: var(--primary); background: #fff; }

/* ---------- 分类标签（切屏） ---------- */
.cat-tabs {
  position: sticky;
  top: 56px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px -16px 0;
  padding: 12px 16px 10px;
  background: rgba(245, 247, 250, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-x: auto;
  scrollbar-width: none;
  transition: top 0.25s ease;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.cat-tab:hover { border-color: var(--primary); color: var(--primary); }
.cat-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.30);
}
.ct-count { font-size: 12px; opacity: 0.7; }
.cat-tab.active .ct-count { opacity: 0.9; }

/* ---------- 分类面板（切屏） ---------- */
.tool-panel { display: none; }
.tool-panel.show { display: block; animation: panelIn 0.28s ease; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 24px 0 2px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.panel-head .ph-count { font-size: 12.5px; font-weight: 400; color: var(--text-sub); }
.search-status { margin: 20px 0 0; font-size: 14px; color: var(--text-sub); }
.no-result {
  display: none;
  text-align: center;
  padding: 52px 16px;
  color: var(--text-sub);
  font-size: 14.5px;
  line-height: 1.8;
}
.no-result.show { display: block; }

/* ---------- 工具卡片网格 ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}
@media (min-width: 640px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .tool-grid { grid-template-columns: repeat(4, 1fr); }
}

.tool-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tool-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.12);
  transform: translateY(-2px);
}
.tool-card { position: relative; }
.tool-card::after {
  content: '→';
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 14px;
  color: var(--primary);
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.2s ease;
}
.tool-card:hover::after { opacity: 1; transform: none; }
.tool-card .tc-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.10), rgba(var(--primary-rgb), 0.22));
  border-radius: 12px;
}
.tool-card .tc-name { font-size: 15px; font-weight: 600; color: var(--text); }
.tool-card .tc-desc {
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.5;
  flex: 1;
}
.tool-card .tc-tag {
  font-size: 11px;
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
  padding: 2px 8px;
  border-radius: 20px;
  align-self: flex-start;
}

/* ---------- 工具页布局 ---------- */
.tool-main {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
}
.tool-main h1 { font-size: 21px; margin-bottom: 6px; text-align: center; }
.tool-subtitle { text-align: center; color: var(--text-sub); font-size: 14px; margin-bottom: 18px; }
.tool-zone { min-height: 60px; }

/* ---------- 页头带（面包屑下的标题区，独立成带） ---------- */
.page-head {
  margin: 0 0 14px;
  padding: 20px 20px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    radial-gradient(420px 150px at 6% 0%, rgba(var(--primary-rgb), 0.12), transparent 62%),
    linear-gradient(135deg, rgba(var(--primary-rgb), 0.05), rgba(var(--primary-rgb), 0.02) 60%, transparent);
}
.page-head h1 { font-size: 21px; margin: 0 0 6px; line-height: 1.35; }
.page-head .page-sub { margin: 0; color: var(--text-sub); font-size: 13.5px; }

/* 表单标签统一 */
.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

/* 空结果框自动隐藏（避免露出灰色空条） */
.result-box:empty { display: none; }

/* 结果区 */
.result-box {
  margin-top: 16px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  word-break: break-all;
}

/* 车牌号段列表（plate-lookup 单字省份查询） */
.pl-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.pl-table th,
.pl-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.pl-table thead th { color: var(--muted); font-weight: 600; }
.pl-table tbody tr:last-child td { border-bottom: none; }
.pl-table tbody td b { color: var(--primary); }

/* ---------- 通用按钮（全站工具页统一调用） ---------- */
.bx-primary,
.bx-plain,
.bx-ghost {
  display: inline-block;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.2;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}
.bx-block { display: block; width: 100%; }
.bx-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  font-weight: 600;
}
.bx-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.bx-primary:active { transform: translateY(1px); }
.bx-plain {
  background: var(--card-bg);
  color: var(--primary);
  border: 1px solid var(--primary);
}
.bx-plain:hover { background: var(--primary-light); }
.bx-ghost {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.bx-ghost:hover { border-color: var(--primary); color: var(--primary); }
.bx-primary:disabled,
.bx-plain:disabled,
.bx-ghost:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- 结果区文本状态 ---------- */
.err { color: var(--danger); }
.ok,
.big { color: var(--primary); }
.big { font-size: 17px; font-weight: 700; }
.muted { color: var(--muted); }
.result-box .big,
.result-box .ok { color: var(--primary); }

/* ---------- 工具页表单控件统一 ---------- */
.tool-zone input[type="text"],
.tool-zone input[type="number"],
.tool-zone input[type="search"],
.tool-zone input[type="date"],
.tool-zone textarea,
.tool-zone select {
  font-family: inherit;
  color: var(--text);
}
.tool-zone textarea { resize: vertical; min-height: 90px; }
.tool-zone input:focus,
.tool-zone textarea:focus,
.tool-zone select:focus {
  outline: none;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ---------- 内容区表格 ---------- */
.tool-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 12px 0;
}
.tool-content th,
.tool-content td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
.tool-content th { background: var(--bg); font-weight: 600; }
.tool-content tr:nth-child(even) td { background: #fafbfc; }

/* 高亮标记（正则等） */
mark { background: #ffe58f; padding: 0 2px; border-radius: 2px; }

/* ---------- 返回顶部 ---------- */
#back-to-top {
  position: fixed;
  right: 16px;
  bottom: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
  display: none;
  z-index: 200;
}
#back-to-top.show { display: block; }


.tool-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-top: 16px;
}
.tool-content h2 {
  font-size: 17px;
  margin: 18px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
  line-height: 1.3;
}
.tool-content h2:first-child { margin-top: 0; }
.tool-content h3 { font-size: 15px; margin: 14px 0 6px; }
.tool-content p { margin: 8px 0; color: var(--text); }
.tool-content ul { padding-left: 20px; margin: 8px 0; }
.tool-content li { margin: 4px 0; }
.tool-content code {
  background: #f0f2f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* 相关工具推荐 */
.related {
  margin-top: 16px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.related h3 { font-size: 15px; margin-bottom: 10px; }
.related-links { display: flex; flex-wrap: wrap; gap: 8px; }
.related-links a {
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
  color: var(--text);
}
.related-links a:hover { border-color: var(--primary); color: var(--primary); }

/* FAQ */
.faq-item details {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.faq-item + .faq-item { margin-top: 8px; }
.faq-item details:hover { border-color: rgba(var(--primary-rgb), 0.4); }
.faq-item details[open] {
  border-color: rgba(var(--primary-rgb), 0.5);
  box-shadow: 0 2px 10px rgba(var(--primary-rgb), 0.08);
}
.faq-item summary {
  position: relative;
  list-style: none;
  padding: 11px 40px 11px 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  transition: color 0.15s ease;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "";
  position: absolute;
  right: 15px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -7px;
  border-right: 2px solid var(--text-sub);
  border-bottom: 2px solid var(--text-sub);
  transform: rotate(45deg);
  transition: transform 0.2s ease, margin-top 0.2s ease;
}
.faq-item details[open] summary::after { transform: rotate(225deg); margin-top: -4px; }
.faq-item details[open] summary { color: var(--primary); }
.faq-item details > p {
  margin: 0;
  padding: 0 14px 13px;
  color: var(--text-sub);
  font-size: 13.5px;
  line-height: 1.7;
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 12px;
}
.breadcrumb a { color: var(--text-sub); }
.breadcrumb a:hover { color: var(--primary); }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 32px;
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  padding: 20px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
}
.site-footer a { color: var(--text-sub); }
.site-footer .icp { margin-top: 6px; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin: 10px auto 0;
  max-width: 900px;
}
.footer-links a { font-size: 12.5px; color: var(--text-sub); }
.footer-links a:hover { color: var(--primary); }
.footer-title { font-weight: 600; color: var(--text); font-size: 13px; }

/* ---------- 移动端底部导航替代下拉 ---------- */
.mobile-nav {
  display: block;
  padding: 0 16px 4px;
  background: var(--card-bg);
}
.mobile-nav select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
@media (min-width: 640px) {
  .nav-desktop { display: flex; gap: 4px; }
  .mobile-nav { display: none; }
}
@media (min-width: 960px) {
  .nav-search { display: flex; }
}

/* 隐藏内容（无障碍/SEO 保留） */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
/* ============================================================
   主题系统（换肤）—— html[data-theme] 切换，默认无属性=默认蓝
   ============================================================ */
html[data-theme="qing"] {
  --primary: #06b6d4; --primary-dark: #0891b2; --primary-rgb: 6, 182, 212;
  --bg: #eef9fb; --footer-bg: #e4f2f5;
  --hero-a: #ecf9fc; --hero-b: #f5fdfe;
}
html[data-theme="green"] {
  --primary: #16a085; --primary-dark: #0d8a72; --primary-rgb: 22, 160, 133;
  --bg: #f0faf6; --footer-bg: #e6f4ee;
  --hero-a: #ecfaf4; --hero-b: #f7fdfa;
}
html[data-theme="purple"] {
  --primary: #8e5cf7; --primary-dark: #7048d8; --primary-rgb: 142, 92, 247;
  --bg: #f8f5fe; --footer-bg: #efeafa;
  --hero-a: #f6f2fe; --hero-b: #fbf9ff;
}
html[data-theme="red"] {
  --primary: #e0524e; --primary-dark: #c73e3a; --primary-rgb: 224, 82, 78;
  --bg: #fdf5f4; --footer-bg: #f9edeb;
  --hero-a: #fdf3f1; --hero-b: #fef9f8;
}
html[data-theme="gray"] {
  --primary: #5f6672; --primary-dark: #4b515b; --primary-rgb: 95, 102, 114;
  --bg: #f5f6f7; --footer-bg: #eceef0;
  --hero-a: #f3f4f6; --hero-b: #f8f9fa;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --primary-rgb: 64, 158, 255;
  --bg: #15171b;
  --card-bg: #1e2126;
  --text: #e8eaed;
  --text-sub: #9aa0a6;
  --muted: #9aa0a6;
  --border: #33373d;
  --footer-bg: #191c20;
  --primary: #409eff;
  --primary-dark: #79bbff;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .hero {
  background:
    radial-gradient(600px 220px at 12% -10%, rgba(var(--primary-rgb), 0.16), transparent 60%),
    radial-gradient(520px 240px at 88% 115%, rgba(255, 176, 32, 0.07), transparent 60%),
    linear-gradient(160deg, #1b1f26 0%, #20242b 60%, #23262a 100%);
}
html[data-theme="dark"] .search-box,
html[data-theme="dark"] .nav-drop,
html[data-theme="dark"] .cat-tab,
html[data-theme="dark"] .mobile-nav select,
html[data-theme="dark"] .nav-search input:focus {
  background: #26292f;
}
html[data-theme="dark"] .nav-search input { background: #26292f; }
html[data-theme="dark"] .sb-clear,
html[data-theme="dark"] .tool-content code {
  background: #32363d;
}
html[data-theme="dark"] .hot-keys a { background: rgba(38, 41, 47, 0.9); }
html[data-theme="dark"] .hot-keys a:hover { background: #26292f; }
html[data-theme="dark"] .cat-tabs {
  background: rgba(21, 23, 27, 0.92);
}
html[data-theme="dark"] .tc-icon {
  background: linear-gradient(135deg, #2a313a, #252a31);
}
html[data-theme="dark"] .tool-card:hover {
  box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.22);
}
html[data-theme="dark"] .tool-main input,
html[data-theme="dark"] .tool-main select,
html[data-theme="dark"] .tool-main textarea { background: #26292f; }

/* ---------- 换肤菜单 ---------- */
.theme-menu { position: relative; display: flex; align-items: center; }
#theme-btn {
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
#theme-btn:hover { border-color: var(--primary); transform: rotate(15deg); }
.theme-pop {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 208px;
  padding: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(48, 49, 51, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 210;
}
.theme-pop.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.theme-pop .tp-title {
  font-size: 12px;
  color: var(--text-sub);
  padding: 0 4px 6px;
}
.theme-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.theme-item:hover { background: rgba(var(--primary-rgb), 0.08); }
.theme-item .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex: none;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
}
html[data-theme="dark"] .theme-item .dot { border-color: #32363d; }
.theme-item.active { background: rgba(var(--primary-rgb), 0.12); font-weight: 600; }
.theme-item .ti-mark { margin-left: auto; color: var(--primary); font-size: 13px; opacity: 0; }
.theme-item.active .ti-mark { opacity: 1; }

/* ============================================================
   小游戏通用样式
   ============================================================ */
.game-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 14px;
}
.game-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--text-sub);
}
.game-chip b { color: var(--primary); font-size: 16px; margin-left: 4px; }
.game-stage {
  display: flex;
  justify-content: center;
  margin: 6px 0;
  touch-action: none;
}
canvas.game-canvas {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 100%;
}
.dpad {
  display: none;
  grid-template-columns: repeat(3, 58px);
  gap: 8px;
  justify-content: center;
  margin: 14px auto 0;
}
.dpad button {
  height: 50px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}
.dpad button:active { background: rgba(var(--primary-rgb), 0.15); border-color: var(--primary); }
.dpad .dpad-blank { visibility: hidden; }
@media (max-width: 900px) and (pointer: coarse) {
  .dpad { display: grid; }
}
.game-tip { font-size: 12.5px; color: var(--text-sub); margin-top: 12px; line-height: 1.7; }
.game-over {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(21, 23, 27, 0.72);
  border-radius: 12px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  z-index: 5;
}
.game-over.show { display: flex; }
.game-over small { font-size: 13px; font-weight: 400; opacity: 0.85; }

/* ============================================================
   JSON 格式化工具（分栏 + 语法高亮 + 可折叠树）
   ============================================================ */
.json-panes { display: grid; gap: 14px; }
@media (min-width: 960px) { .json-panes { grid-template-columns: 1fr 1fr; align-items: stretch; } }
.json-pane { display: flex; flex-direction: column; min-width: 0; }
.jp-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px; min-height: 28px;
}
.jp-title { font-size: 13px; font-weight: 600; color: var(--text); }
.jp-file {
  font-size: 12.5px; color: var(--primary); cursor: pointer;
  border: 1px dashed var(--border); border-radius: 6px; padding: 3px 10px;
  transition: border-color 0.15s ease;
}
.jp-file:hover { border-color: var(--primary); }
.json-pane textarea {
  width: 100%; min-height: 380px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  font-family: Consolas, Menlo, "Courier New", monospace;
  font-size: 13px; line-height: 1.6; resize: vertical;
  background: var(--card-bg); color: var(--text); transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.json-pane textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}
.json-pane textarea.drag { border-color: var(--primary); border-style: dashed; }
.json-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.json-btns .bx-primary { flex: 2; min-width: 96px; }
.json-btns .bx-plain { flex: 1; min-width: 68px; }
.json-btns.sub { margin-top: 6px; }
.json-btns.sub .bx-ghost { flex: 1; min-width: 68px; }
.jp-mini {
  border: 1px solid var(--border); background: var(--card-bg); color: var(--text-sub);
  border-radius: 6px; padding: 3px 10px; font-size: 12px; cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.jp-mini:hover { color: var(--primary); border-color: var(--primary); }
.jp-tools { display: flex; gap: 6px; }

.jv-view-wrap {
  flex: 1; min-height: 380px; max-height: 620px; overflow: auto;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card-bg); padding: 8px 0; box-sizing: border-box;
}
.jv-view { font-family: Consolas, Menlo, "Courier New", monospace; font-size: 13px; line-height: 1.75; }
.jv-line { display: flex; white-space: pre; padding: 0 12px 0 4px; }
.jv-line:hover { background: rgba(var(--primary-rgb), 0.06); }
.jv-ln {
  flex: none; width: 46px; text-align: right; padding-right: 10px;
  color: var(--text-sub); opacity: 0.55; font-size: 11.5px;
  user-select: none; line-height: inherit;
}
.jv-toggle {
  flex: none; width: 22px; text-align: center; cursor: pointer;
  color: var(--text-sub); user-select: none;
  transition: transform 0.15s ease; line-height: inherit;
}
.jv-toggle:hover { color: var(--primary); }
.jv-toggle.jv-leaf { cursor: default; }
.jv-line.folded .jv-toggle { transform: rotate(-90deg); }
.jv-code { white-space: pre; }
.jv-summary { display: none; color: var(--text-sub); font-style: italic; padding-left: 2px; }
.jv-tailbrace { display: none; }
.jv-line.folded .jv-summary, .jv-line.folded .jv-tailbrace { display: inline; }
.jv-hide { display: none !important; }
.jv-key { color: #a626a4; }
.jv-str { color: #50a14f; }
.jv-num { color: #986801; }
.jv-bool { color: #c18401; }
.jv-null { color: #a0a1a7; font-style: italic; }
.jv-brace { color: var(--text); }
.jv-colon, .jv-comma { color: var(--text); }
.json-status { margin-top: 8px; font-size: 13px; line-height: 1.6; }
.json-status.ok { color: #67C23A; }
.json-status.bad { color: #F56C6C; }
.json-status b { font-weight: 700; }

html[data-theme="dark"] .jv-key { color: #c678dd; }
html[data-theme="dark"] .jv-str { color: #98c379; }
html[data-theme="dark"] .jv-num { color: #d19a66; }
html[data-theme="dark"] .jv-bool { color: #e5c07b; }
html[data-theme="dark"] .jv-null { color: #7d838e; }
html[data-theme="dark"] .jv-line:hover { background: rgba(var(--primary-rgb), 0.10); }
html[data-theme="dark"] .json-status.ok { color: #95d475; }
html[data-theme="dark"] .json-status.bad { color: #f89898; }
.jv-code.jv-min { white-space: pre-wrap; word-break: break-all; padding-right: 12px; }

/* ============================================================
   亲属称谓计算器
   ============================================================ */
.rel-opts { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 12px; }
.rel-opt { display: flex; align-items: center; gap: 8px; }
.rel-opt-label { font-size: 13px; color: var(--text-sub); }
.rel-seg {
  display: inline-flex; background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px;
}
.rel-seg button {
  border: none; background: transparent; color: var(--text-sub);
  font-family: inherit; font-size: 13px; padding: 5px 13px;
  border-radius: 999px; cursor: pointer; transition: all 0.15s ease;
}
.rel-seg button.on { background: var(--primary); color: #fff; font-weight: 600; }
.rel-chain {
  min-height: 46px; background: var(--bg);
  border: 1px dashed var(--border); border-radius: 10px;
  padding: 9px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.rel-chip {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 11px; font-size: 14px; color: var(--text);
  cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease;
}
.rel-chip[data-i]:hover { border-color: var(--primary); color: var(--primary); }
.rel-chip.rel-me {
  background: rgba(var(--primary-rgb), 0.12);
  border-color: rgba(var(--primary-rgb), 0.4);
  color: var(--primary); font-weight: 700; cursor: default;
}
.rel-arrow { color: var(--text-sub); font-size: 13px; }
.rel-hint { color: var(--text-sub); font-size: 13px; }
.rel-out .rel-big {
  font-size: 27px; font-weight: 800; color: var(--primary); line-height: 1.35;
}
.rel-out .rel-sub { margin-top: 6px; font-size: 14.5px; color: var(--text); }
.rel-out .rel-rk { margin-top: 6px; font-size: 13px; color: var(--text-sub); }
.rel-out .rel-desc { margin-top: 8px; font-size: 13px; color: var(--text-sub); }
.rel-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 14px; }
.rel-pad button {
  font-family: inherit; font-size: 15px; padding: 12px 4px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--card-bg); color: var(--text); cursor: pointer;
  transition: all 0.16s ease; touch-action: manipulation;
}
.rel-pad button:hover { border-color: var(--primary); color: var(--primary); }
.rel-pad button:active { transform: translateY(1px); background: rgba(var(--primary-rgb), 0.1); }
.rel-pad .rp-back, .rel-pad .rp-clear { color: var(--text-sub); font-size: 14px; }
.rel-input { display: flex; gap: 8px; margin-top: 12px; }
.rel-input input {
  flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 15px; font-family: inherit;
  background: var(--card-bg); color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rel-input input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}
.rel-ex { margin-top: 12px; font-size: 13px; color: var(--text-sub); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rel-ex button {
  font-family: inherit; font-size: 12.5px; padding: 4px 11px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text-sub); cursor: pointer;
  transition: all 0.15s ease;
}
.rel-ex button:hover { border-color: var(--primary); color: var(--primary); }
@media (max-width: 560px) {
  .rel-pad { grid-template-columns: repeat(4, 1fr); }
  .rel-out .rel-big { font-size: 23px; }
}
/* ============================================================
   随机网名生成器
   ============================================================ */
.nm-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
}
.nm-item span { font-size: 15px; color: var(--text); word-break: break-all; }
.nm-item .bx-plain { padding: 6px 14px; font-size: 13px; flex: none; }
