/* ============================================================
   base.css —— 全局设计系统（MINI-H 暗色主题）
   ============================================================ */

:root {
  --bg:        #080a0d;
  --bg-2:      #0d1116;
  --panel:     rgba(255, 255, 255, 0.045);
  --panel-2:   rgba(255, 255, 255, 0.075);
  --border:    rgba(255, 255, 255, 0.10);
  --border-2:  rgba(255, 255, 255, 0.18);
  --text:      #e9edf2;
  --text-dim:  #98a2b0;
  --text-mute: #6b7480;
  --yellow:    #fdda5f;   /* 小黄脸 */
  --yellow-2:  #fd9744;
  --cyan:      #2ee6c5;   /* 发光青 */
  --cyan-2:    #1c9c8c;
  --blue:      #5aa9ff;
  --purple:    #a78bfa;
  --danger:    #ff6b6b;
  --ok:        #4ade80;
  --warn:      #fbbf24;
  --radius:    14px;
  --radius-s:  9px;
  --shadow:    0 10px 34px rgba(0, 0, 0, 0.55);
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  --header-h: 62px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  /* 星空底纹 */
  content: "";
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1100px 620px at 78% -10%, rgba(46, 230, 197, 0.10), transparent 60%),
    radial-gradient(900px 520px at 8% 8%, rgba(253, 218, 95, 0.07), transparent 62%),
    radial-gradient(800px 500px at 50% 110%, rgba(90, 169, 255, 0.07), transparent 60%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, rgba(255,255,255,.45) 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 68%, rgba(255,255,255,.35) 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 62% 82%, rgba(255,255,255,.4) 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 58%, rgba(255,255,255,.3) 50%, transparent 51%),
    radial-gradient(1px 1px at 20% 88%, rgba(255,255,255,.3) 50%, transparent 51%);
  background-size: 100% 100%;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, textarea, select { font-family: inherit; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.26); }

/* ---------------- 顶部导航 ---------------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 clamp(14px, 3vw, 34px);
  background: rgba(8, 10, 13, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 900;
}
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--border);
  transition: .2s;
}
.brand:hover .brand-logo { border-color: var(--yellow); }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-logo .brand-emoji { font-size: 19px; line-height: 1; }
.brand-logo .mini-face {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--yellow); box-shadow: inset 2px -4px 10px var(--yellow-2);
  position: relative; flex: none;
}
.brand-logo .mini-face::before, .brand-logo .mini-face::after {
  content: ""; position: absolute; top: 8px; width: 3.5px; height: 3.5px; border-radius: 50%;
  background: #2a2927; animation: eyeBlink 3.4s linear infinite;
}
.brand-logo .mini-face::before { left: 6px; }
.brand-logo .mini-face::after  { right: 6px; }
.brand-logo .mini-face i {
  position: absolute; left: 9px; top: 16px; width: 6px; height: 2px; background: #2a2927; border-radius: 2px;
}
@keyframes eyeBlink { 0%,30%,36%,100% { transform: scale(1);} 32%,34% { transform: scale(1,0);} }
.brand b { font-size: 17px; letter-spacing: 2px; font-weight: 700; }
.brand span { font-size: 11px; color: var(--text-mute); letter-spacing: 1px; }

.nav { display: flex; align-items: center; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative; padding: 8px 13px; border-radius: 999px; font-size: 14px;
  color: var(--text-dim); white-space: nowrap; transition: .22s;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a.active { color: #0b0f13; background: var(--yellow); font-weight: 600; }
.nav a.active:hover { background: var(--yellow); color: #0b0f13; }

.header-right { display: flex; align-items: center; gap: 10px; flex: none; }

.nav-toggle { display: none; }

/* ---------------- 页面容器 ---------------- */
.page { padding-top: var(--header-h); min-height: 100vh; display: flex; flex-direction: column; }
.wrap { width: min(1240px, 100% - 2 * clamp(14px, 3vw, 40px)); margin-inline: auto; }
main { flex: 1; }

/* ---------------- 组件 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-s); border: 1px solid var(--border-2);
  background: var(--panel); color: var(--text); font-size: 14px; cursor: pointer;
  transition: .2s; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); border-color: var(--cyan); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--yellow), #ffc93c); color: #201a05; border-color: transparent; font-weight: 600; }
.btn-primary:hover { background: linear-gradient(135deg, #ffe27f, var(--yellow)); border-color: transparent; }
.btn-cyan { background: linear-gradient(135deg, var(--cyan), var(--cyan-2)); color: #04211d; border-color: transparent; font-weight: 600; }
.btn-danger { color: var(--danger); border-color: rgba(255,107,107,.4); }
.btn-danger:hover { background: rgba(255,107,107,.14); border-color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); }

/* FontAwesome 图标统一渲染参数：避免小字号下笔画被量化成方块 */
.fa { text-rendering: geometricPrecision; -webkit-font-smoothing: antialiased; }
.btn .fa { font-size: .92em; }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.panel-title {
  display: flex; align-items: center; gap: 9px; margin: 0 0 14px;
  font-size: 15px; font-weight: 600; letter-spacing: .5px;
}
.panel-title i { color: var(--yellow); }
.panel-title .spacer { flex: 1; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: rgba(90,169,255,.12); color: #9fc7ff; border: 1px solid rgba(90,169,255,.24);
  cursor: pointer; transition: .18s;
}
.tag:hover { background: rgba(90,169,255,.24); }
.tag.y { background: rgba(253,218,95,.13); color: var(--yellow); border-color: rgba(253,218,95,.28); }
.tag.y:hover { background: rgba(253,218,95,.26); }
.tag.c { background: rgba(46,230,197,.12); color: var(--cyan); border-color: rgba(46,230,197,.26); }

.input, textarea.input, select.input {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-s);
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; outline: none; transition: .18s;
}
.input:focus { border-color: var(--cyan); background: rgba(255,255,255,.075); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.7; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; letter-spacing: .5px; }

.empty { padding: 46px 20px; text-align: center; color: var(--text-mute); font-size: 14px; }
.empty i { display: block; font-size: 34px; margin-bottom: 12px; opacity: .5; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px;
  background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border);
}
.badge.ok { color: var(--ok); background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.3); }
.badge.warn { color: var(--warn); background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.3); }
.badge.danger { color: var(--danger); background: rgba(255,107,107,.12); border-color: rgba(255,107,107,.3); }

.section-title {
  display: flex; align-items: baseline; gap: 12px; margin: 0 0 18px;
}
.section-title h2 { margin: 0; font-size: 20px; letter-spacing: 1px; }
.section-title p { margin: 0; font-size: 13px; color: var(--text-mute); }

/* ---------------- 页脚 ---------------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 56px;
  padding: 26px 0 34px; font-size: 12.5px; color: var(--text-mute);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: space-between; align-items: center; }
.site-footer a:hover { color: var(--cyan); }

/* ---------------- Toast ---------------- */
#toastBox { position: fixed; z-index: 3000; top: 78px; right: 22px; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 11px 16px; border-radius: var(--radius-s); font-size: 13.5px;
  background: rgba(18, 22, 28, .96); border: 1px solid var(--border-2);
  box-shadow: var(--shadow); animation: toastIn .28s ease; max-width: 320px;
  display: flex; align-items: center; gap: 9px;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--cyan); }
@keyframes toastIn { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }

/* ---------------- Modal ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 2000; display: none;
  background: rgba(3, 5, 8, .72); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  width: min(560px, 100%); max-height: 86vh; overflow: auto;
  background: #101419; border: 1px solid var(--border-2); border-radius: var(--radius);
  box-shadow: var(--shadow); animation: modalIn .24s ease;
}
/* 全屏弹窗：用于文章编辑器这类需要大面积工作区的场景 */
.modal-mask.mask-wide { padding: 0; }
.modal-mask.mask-wide .modal {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  border-radius: 0; border: 0; display: flex; flex-direction: column; overflow: hidden;
}
.modal-mask.mask-wide .modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.modal-mask.mask-wide .modal-head, .modal-mask.mask-wide .modal-foot { flex: 0 0 auto; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.x-close { background: none; border: none; color: var(--text-mute); cursor: pointer; font-size: 16px; padding: 4px 7px; border-radius: 6px; }
.x-close:hover { color: var(--text); background: var(--panel-2); }

/* ---------------- 小黄脸（通用互动组件） ---------------- */
.face-wrap {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 100px; height: 100px; cursor: pointer; user-select: none;
}
.face-wrap .face {
  position: relative; width: 100px; height: 100px; border-radius: 50%;
  background: var(--yellow); box-shadow: inset 3px -6px 26px var(--yellow-2), 0 16px 40px rgba(253, 218, 95, .22);
  will-change: transform; transition: filter .3s;
}
.face-wrap .eyes {
  position: absolute; left: 50%; top: 38px; transform: translateX(-50%);
  width: 46px; height: 13px; will-change: transform;
}
.face-wrap .eye {
  position: absolute; top: 0; width: 12px; height: 12px; border-radius: 50%;
  background: #2a2927; box-shadow: inset 1px 2px 4px #121110;
  animation: eyeBlink 3.2s linear infinite;
}
.face-wrap .eye.left { left: 0; }
.face-wrap .eye.right { right: 0; }
.face-wrap .mouth {
  position: absolute; left: 50%; top: 62px; transform: translateX(-50%);
  width: 26px; height: 3px; background: #2a2927; border-radius: 3px; transition: .25s;
}
.face-wrap:hover .mouth {
  width: 18px; height: 12px; border-radius: 14px 14px 4px 4px; top: 60px;
}
.face-wrap:hover .eye { height: 10px; box-shadow: 0 0 0 3px #fff; }
.face-wrap.touch .mouth { width: 16px; height: 15px; border-radius: 16px 16px 4px 4px; }
.face-wrap .tip {
  position: absolute; bottom: -26px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--text-mute); white-space: nowrap;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border);
    background: var(--panel); color: var(--text); cursor: pointer; font-size: 15px;
  }
  .site-header { flex-wrap: wrap; }
  .nav {
    order: 3; flex-basis: 100%; display: none; padding: 8px 0 12px;
    border-top: 1px solid var(--border); margin-top: 8px;
  }
  .nav.open { display: flex; }
  .brand span { display: none; }
}
@media (max-width: 520px) {
  .site-footer .wrap { justify-content: center; text-align: center; }
}

/* ============================================================
   SVG 图标系统（icons.js）
   替代 FontAwesome webfont，避免在受限环境下渲染成「豆腐块」
   ============================================================ */
.svg-ico {
  display: inline-block; vertical-align: -0.14em;
  flex: none; overflow: visible;
  /* 与文字同行时保持稳定基线 */
  line-height: 1;
}
.svg-ico.filled { fill: currentColor; }

/* 图标容器：统一承接原本写在 <i> 上的颜色/尺寸样式 */
.ico {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; line-height: 1; color: inherit;
}
/* 关键：.ico 内绝不允许出现伪元素字形。
   FontAwesome 的 .fa::before 会画出字形，且伪元素不占 DOM 节点，
   一旦容器残留 'fa' 类就会与 SVG 并排显示成两个图标。此处强制清空。 */
.ico::before, .ico::after { content: none !important; }
/* 兼容：外部若给 .fa 设了字号，SVG 尺寸由 JS 按字号推导，此处不覆盖 */
.ico.fa { font-size: inherit; }

/* ---------- 可视化图标选择器（替代自由文本输入，杜绝库外名称） ---------- */
.ico-pick {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 11px;
  background: var(--panel-2, rgba(255,255,255,.075));
  border: 1px solid var(--border, rgba(255,255,255,.10));
  border-radius: 8px; color: var(--text);
  font: inherit; font-size: 13px; cursor: pointer;
  transition: border-color .18s, background .18s;
  white-space: nowrap;
}
.ico-pick:hover { border-color: var(--yellow, #fdda5f); background: rgba(253,218,95,.07); }
.ico-pick .ip-prev { display: inline-flex; color: var(--yellow, #fdda5f); }
.ico-pick .ip-name { opacity: .82; }

.ico-panel {
  position: fixed; z-index: 9999;
  width: 320px; max-width: calc(100vw - 24px);
  /* 浮层必须不透明：--panel 是半透明色，叠在弹窗上会透出底层内容 */
  background: var(--bg-2, #151a21);
  background-image: linear-gradient(rgba(255,255,255,.035), rgba(255,255,255,.035));
  border: 1px solid var(--border-2, rgba(255,255,255,.18));
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0,0,0,.5);
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.ico-panel .ip-head { display: flex; align-items: center; gap: 8px; }
.ico-panel .ip-search { flex: 1; height: 30px; font-size: 13px; }
.ico-panel .ip-count { font-size: 11.5px; color: var(--text-mute); flex: none; }
.ico-panel .ip-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  max-height: 264px; overflow-y: auto; padding-right: 2px;
}
.ico-panel .ip-item {
  aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--text-dim); cursor: pointer; padding: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.ico-panel .ip-item:hover { background: rgba(255,255,255,.07); color: var(--text); }
.ico-panel .ip-item.on {
  border-color: var(--yellow, #fdda5f); color: var(--yellow, #fdda5f);
  background: rgba(253,218,95,.1);
}
.ico-panel .ip-item .svg-ico { width: 20px; height: 20px; }
