/* IconHub 站点样式 —— 系统字体栈，无外部资源 */
:root {
  --bg: #ffffff; --fg: #1f2329; --muted: #7a8087; --line: #e5e7eb;
  --card: #f5f6f8; --card2: #eceef1; --brand: #4c88ff; --brand-weak: #eaf1ff;
  --danger: #f54a45; --shadow: 0 8px 32px rgba(31, 35, 41, .14);
  --radius: 10px;
}
html.dark {
  --bg: #17191c; --fg: #e8eaed; --muted: #9aa0a6; --line: #2e3238;
  --card: #24272b; --card2: #2d3136; --brand: #6f9dff; --brand-weak: #24304a;
  --shadow: 0 8px 32px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
/* hidden 属性必须压过组件自身的 display（.cell flex / .grid grid / .btn flex） */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; }
code, .mono { font-family: ui-monospace, Consolas, "Courier New", monospace; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
svg { vertical-align: middle; }

/* ---------- 头部 ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--line); }
.header-in { display: flex; align-items: center; gap: 18px; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand-sub { color: var(--muted); font-size: 12px; margin-left: 2px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { color: var(--fg); background: var(--card); text-decoration: none; }
.nav a.on { color: var(--brand); background: var(--brand-weak); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--fg); cursor: pointer;
}
.icon-btn:hover { background: var(--card); }
.icon-btn svg { width: 18px; height: 18px; }
html:not(.dark) .i-sun, html.dark .i-moon { display: none; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg);
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--card); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 3px 10px; font-size: 12px; }
.btn.link { color: var(--brand); border-color: transparent; }
.fav-btn[aria-pressed="true"] { color: #ffb400; border-color: #ffb400; }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 56px 0 8px; }
.hero h1 { font-size: 34px; margin: 0 0 10px; }
.hero-sub { color: var(--muted); font-size: 15px; margin: 0 0 24px; }
.big-search {
  display: flex; align-items: center; gap: 10px; max-width: 620px; margin: 0 auto;
  padding: 6px 6px 6px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.big-search:focus-within { border-color: var(--brand); background: var(--bg); box-shadow: 0 0 0 3px var(--brand-weak); }
.big-search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.big-search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--fg); font-size: 15px; min-width: 0; }
.hero-stats { margin: 16px 0 0; font-size: 13px; }
.home-sec { margin: 40px 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.sec-head h2 { font-size: 18px; margin: 0; }
.more { font-size: 13px; }

/* ---------- 图标网格 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.cell {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 16px 6px 12px; background: var(--card); border-radius: var(--radius);
  cursor: pointer; user-select: none; content-visibility: auto; contain-intrinsic-size: 96px;
  transition: background .15s, color .15s, transform .1s;
}
.cell:hover, .cell:focus-visible { background: var(--card2); transform: translateY(-1px); outline: none; }
.cell-icon { color: var(--fg); display: flex; }
.cell-zh { font-size: 12px; }
.cell-id { font-size: 10px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-fav {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  cursor: pointer; opacity: 0; transition: opacity .12s;
}
.cell:hover .cell-fav, .cell-fav:focus-visible, .cell-fav[aria-pressed="true"] { opacity: 1; }
.cell-fav:hover { background: var(--bg); color: var(--fg); }
.cell-fav[aria-pressed="true"] { color: #ffb400; }
.cell-fav svg { width: 15px; height: 15px; }
.cell-fav[aria-pressed="true"] svg { fill: currentColor; }

/* ---------- 分类卡片 ---------- */
.cat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.cat-card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--fg);
}
.cat-card:hover { border-color: var(--brand); text-decoration: none; }
.cat-samples { display: flex; gap: 10px; color: var(--fg); flex-wrap: wrap; }
.cat-name { font-weight: 600; }
.cat-count { color: var(--muted); font-size: 12px; }

/* ---------- 浏览页 ---------- */
.browse { display: flex; gap: 24px; align-items: flex-start; padding: 24px 0 48px; }
.side { width: 168px; flex: none; position: sticky; top: 76px; }
.side h2 { font-size: 13px; color: var(--muted); margin: 0 0 8px; font-weight: 500; }
.side a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px; color: var(--fg); font-size: 13px;
}
.side a i { font-style: normal; color: var(--muted); font-size: 12px; }
.side a:hover { background: var(--card); text-decoration: none; }
.side a.on { background: var(--brand-weak); color: var(--brand); }
.side a.on i { color: var(--brand); }
.browse-main { flex: 1; min-width: 0; }
.toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
.toolbar:focus-within { border-color: var(--brand); background: var(--bg); }
.toolbar svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.toolbar input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--fg); font-size: 14px; min-width: 0; }
#browse-count { font-size: 12px; flex: none; }

/* ---------- 风格切换 / 筛选 ---------- */
.style-tabs {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
}
.style-tabs .st-label { color: var(--muted); font-size: 12px; margin-right: 2px; }
.style-tabs a, .style-tabs button {
  padding: 4px 12px; border: 1px solid var(--line); border-radius: 99px;
  background: var(--bg); color: var(--muted); font-size: 13px; cursor: pointer;
}
.style-tabs a:hover, .style-tabs button:hover { color: var(--fg); background: var(--card); text-decoration: none; }
.style-tabs a.on, .style-tabs button.on {
  color: var(--brand); border-color: var(--brand); background: var(--brand-weak);
}
.style-tabs i { font-style: normal; font-size: 11px; margin-left: 2px; }
.modal-styles { padding: 0 18px; margin-bottom: 0; }
.modal-styles[hidden] { display: none; }

/* ---------- 搜索联想下拉 ---------- */
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; padding: 6px;
}
.suggest[hidden] { display: none; }
.sg-item, .sg-more {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 7px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--fg); font-size: 13px; cursor: pointer;
}
.sg-item:hover, .sg-item.on, .sg-more:hover, .sg-more.on { background: var(--card); }
.sg-icon { display: flex; color: var(--fg); flex: none; }
.sg-zh { flex: none; }
.sg-id { color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-more { justify-content: center; color: var(--brand); border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 9px; }

/* ---------- 弹层 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.modal-panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 48px));
  overflow: auto; background: var(--bg); border-radius: 14px; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.modal-head h2 { font-size: 17px; margin: 0; }
.head-actions { display: flex; gap: 8px; }
.modal-body { display: flex; gap: 18px; padding: 8px 18px 18px; }
.modal-stage {
  flex: none; width: 200px; height: 200px; border-radius: 12px; background: var(--card);
  display: flex; align-items: center; justify-content: center; color: var(--fg);
  background-image: linear-gradient(45deg, var(--card2) 25%, transparent 25%, transparent 75%, var(--card2) 75%), linear-gradient(45deg, var(--card2) 25%, transparent 25%, transparent 75%, var(--card2) 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px;
}
.modal-stage.dark { background-color: #17191c; color: #e8eaed; }
.modal-stage.dark:has(+ *), .modal-stage.dark { --card2: #24272b; }
.modal-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.sizes { display: flex; align-items: flex-end; gap: 14px; color: var(--fg); }
.size-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.size-cell i { font-style: normal; font-size: 10px; color: var(--muted); }
.color-row, .kw-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-row > label, .kw-row > label { color: var(--muted); font-size: 12px; flex: none; }
.swatches { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch.on { outline: 2px solid var(--brand); outline-offset: 1px; }
.swatches input[type="color"] { width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 50%; padding: 0; background: none; cursor: pointer; }
.cc-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 10px; border-radius: 99px; background: var(--card); color: var(--muted); font-size: 12px; }
.chip:hover { color: var(--brand); text-decoration: none; background: var(--brand-weak); }
.meta-line { margin: 0; font-size: 12px; color: var(--muted); }
.act-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- 详情页 ---------- */
.crumbs { padding: 18px 0 6px; font-size: 13px; color: var(--muted); }
.crumbs b { color: var(--fg); font-weight: 600; }
.detail { display: flex; gap: 24px; align-items: flex-start; padding: 8px 0 48px; }
.detail-main { width: 320px; flex: none; position: sticky; top: 76px; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--bg); }
.stage {
  height: 220px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: var(--fg); background: var(--card);
  background-image: linear-gradient(45deg, var(--card2) 25%, transparent 25%, transparent 75%, var(--card2) 75%), linear-gradient(45deg, var(--card2) 25%, transparent 25%, transparent 75%, var(--card2) 75%);
  background-size: 22px 22px; background-position: 0 0, 11px 11px;
}
.stage.dark { background-color: #17191c; --card2: #24272b; color: #e8eaed; }
.stage-tools { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.detail-side { flex: 1; min-width: 0; }
.detail-side h1 { font-size: 24px; margin: 0 0 6px; }
.id-code { font-size: 14px; color: var(--muted); font-weight: normal; background: var(--card); padding: 2px 8px; border-radius: 6px; }
.detail-side h2 { font-size: 15px; margin: 26px 0 10px; }
.fav-btn[aria-pressed="true"]::before { content: "★"; margin-right: 2px; }
.fav-btn::before { content: "☆ "; margin-right: 0; }

/* 代码块 */
.codeblock { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.codeblock header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--card); }
.codeblock pre { margin: 0; padding: 12px; overflow: auto; background: var(--bg); max-height: 260px; }
.codeblock code { font-size: 12px; line-height: 1.5; }
.pn { display: flex; justify-content: space-between; margin-top: 22px; font-size: 13px; }

/* ---------- 收藏 / 日志 / 404 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; padding: 26px 0 6px; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head.center { flex-direction: column; gap: 8px; text-align: center; padding: 64px 0; }
.empty-box { text-align: center; padding: 48px 0; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty-box[hidden] { display: none; }
.log-sec h2 { font-size: 16px; margin: 28px 0 10px; }
.log-sec h2 small { color: var(--muted); font-weight: normal; font-size: 12px; margin-left: 8px; }
.log-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 18px; }
.log-list a { color: var(--fg); display: flex; gap: 8px; justify-content: space-between; padding: 4px 8px; border-radius: 6px; }
.log-list a:hover { background: var(--card); text-decoration: none; color: var(--brand); }
.log-list code { color: var(--muted); font-size: 12px; }

/* ---------- Toast / 页脚 ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 8px 18px; border-radius: 99px;
  font-size: 13px; z-index: 200; box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 22px 0 34px; color: var(--muted); font-size: 13px; }
.site-footer p { margin: 4px 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 880px) {
  .brand-sub { display: none; }
  .hero h1 { font-size: 26px; }
  .browse { flex-direction: column; }
  .side {
    position: static; width: 100%; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px;
  }
  .side h2 { display: none; }
  .side a { flex: none; border: 1px solid var(--line); }
  .detail, .modal-body { flex-direction: column; }
  .detail-main { width: 100%; position: static; }
  .modal-stage { width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
  .nav a { padding: 6px 8px; font-size: 13px; }
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
