:root {
  color-scheme: dark;
  --canvas: #000000;
  --surface: #f5f5f7;
  --card: #141416;
  --ink: #f5f5f7;
  --secondary: #a8a8ad;
  --tertiary: #737378;
  --accent: #a8bfa8;
  --accent-deep: #c2d6c1;
  --accent-soft: rgba(168, 191, 168, .14);
  --line: rgba(255, 255, 255, .12);
  --line-strong: rgba(255, 255, 255, .2);
  --field: rgba(255, 255, 255, .055);
  --hover: rgba(255, 255, 255, .055);
  --header: #000000;
  --header-height: 68px;
  --font: "Meican Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --canvas: #f4efe5;
  --surface: #2c2820;
  --card: #fffdf7;
  --ink: #29251e;
  --secondary: #716b61;
  --tertiary: #8d8679;
  --accent: #728e71;
  --accent-deep: #4d6b50;
  --accent-soft: rgba(85, 122, 88, .12);
  --line: rgba(74, 63, 46, .13);
  --line-strong: rgba(74, 63, 46, .22);
  --field: rgba(91, 76, 55, .055);
  --hover: rgba(0, 0, 0, .04);
  --header: #f4efe5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
input { font: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
::selection { color: var(--ink); background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 3px; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sprite-host { position: absolute; width: 0; height: 0; overflow: hidden; }

.icons-header {
  position: sticky;
  z-index: 100;
  top: 0;
  height: var(--header-height);
  background: var(--header);
  border-bottom: 1px solid var(--line);
}
.header-inner { height: 100%; max-width: 1500px; margin: auto; padding: 0 36px; display: flex; align-items: center; gap: 18px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.header-link { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 12px; background: var(--surface); color: var(--canvas); font-size: 12px; font-weight: 600; }
.header-link svg { width: 15px; height: 15px; }
.icon-button { width: 42px; height: 42px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: transparent; transition: background 170ms ease-out, transform 170ms ease-out; }
.icon-button:hover { background: var(--hover); }
.icon-button:active { transform: scale(.97); opacity: .9; }
.theme-icon-sun { display: none; }
html[data-theme="light"] .theme-icon-sun { display: block; }
html[data-theme="light"] .theme-icon-moon { display: none; }

.icons-main { max-width: 1500px; margin: 0 auto; padding: 0 36px; }
.icons-hero { padding: clamp(56px, 7vw, 88px) 0 40px; }
.icons-hero h1 { margin: 0; font-size: clamp(46px, 5.2vw, 72px); line-height: 1.06; letter-spacing: -2.8px; font-weight: 600; }
.icons-hero > p:last-child { max-width: 660px; margin: 22px 0 0; color: var(--secondary); font-size: 14px; line-height: 1.85; }

.toolbar { position: sticky; z-index: 20; top: var(--header-height); padding: 18px 0 14px; background: var(--canvas); border-bottom: 1px solid var(--line); }
.search-row { display: flex; align-items: center; gap: 12px; }
.search-field { flex: 1; min-height: 54px; display: flex; align-items: center; gap: 11px; padding: 0 12px 0 16px; border: 1px solid var(--line); border-radius: 17px; background: var(--field); transition: border-color 170ms ease-out; }
.search-field:focus-within { border-color: var(--accent); }
.search-field > svg { width: 18px; height: 18px; color: var(--tertiary); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 15px; }
.search-field input::placeholder { color: var(--tertiary); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: transparent; color: var(--tertiary); }
.search-field button:hover { background: var(--hover); color: var(--ink); }
.search-field button svg { width: 15px; height: 15px; }
.search-field kbd { min-width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--tertiary); font: 11px var(--font); }
.result-line { margin-top: 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; color: var(--tertiary); font-size: 11px; font-variant-numeric: tabular-nums; }
.result-hint { color: var(--tertiary); }
.category-row { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.category-row::-webkit-scrollbar { display: none; width: 0; height: 0; }
.category-chip { min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--secondary); font-size: 11.5px; white-space: nowrap; transition: color 170ms ease-out, background 170ms ease-out, border-color 170ms ease-out; }
.category-chip:hover { color: var(--ink); background: var(--hover); }
.category-chip.selected { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-deep); }

.icon-section { padding: 22px 0 10px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 8px; }
.icon-card {
  position: relative;
  min-height: 116px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 11px;
  padding: 18px 10px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  text-align: center;
  content-visibility: auto;
  contain-intrinsic-size: auto 116px;
  transition: background 170ms ease-out, border-color 170ms ease-out, transform 170ms ease-out;
}
.icon-card:hover { background: var(--hover); border-color: var(--line-strong); }
.icon-card:active { transform: scale(.98); }
.icon-card .glyph { width: 28px; height: 28px; stroke-width: 1.7; color: var(--ink); }
.icon-name { max-width: 100%; color: var(--secondary); font-size: 11px; line-height: 1.35; letter-spacing: -.1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-card::after { content: "Copy"; position: absolute; top: 8px; right: 10px; color: var(--accent-deep); font-size: 8px; font-weight: 600; letter-spacing: .4px; opacity: 0; transition: opacity 170ms ease-out; }
.icon-card:hover::after, .icon-card:focus-visible::after { opacity: .85; }
.icon-card.copied { border-color: var(--accent); }
.icon-card.copied::after { content: "Copied"; opacity: 1; }

.empty-state { margin: 48px 0; color: var(--secondary); font-size: 13px; line-height: 1.8; text-align: center; }
.load-status { margin: 22px 0 0; color: var(--tertiary); font-size: 11px; text-align: center; font-variant-numeric: tabular-nums; }

.icons-footer { margin-top: 52px; padding: 26px 0 40px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; border-top: 1px solid var(--line); color: var(--tertiary); font-size: 10px; }
.icons-footer a { color: var(--secondary); }
.icons-footer a:hover { color: var(--ink); }
.icons-footer a:last-child { margin-left: auto; color: var(--accent-deep); }

.toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}
.toast svg { width: 15px; height: 15px; color: var(--accent-deep); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  :root { --header-height: 62px; }
  .header-inner { padding: 0 20px; }
  .header-link { display: none; }
  .icons-main { padding: 0 20px; }
  .icons-hero { padding: 48px 0 32px; }
  .result-hint { display: none; }
  .category-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -ms-overflow-style: none; }
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
  .icon-card { min-height: 104px; }
}

@media (max-width: 520px) {
  .header-inner { padding: 0 16px; }
  .icons-main { padding: 0 16px; }
  .icons-hero h1 { font-size: clamp(40px, 11vw, 52px); letter-spacing: -2px; }
  .search-field kbd { display: none; }
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 6px; }
  .icon-card { min-height: 96px; padding: 14px 8px 12px; border-radius: 15px; }
  .icon-card .glyph { width: 24px; height: 24px; }
  .icon-name { font-size: 10px; }
  .icons-footer a:last-child { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
