:root {
  --page-scale: 0.8;
  zoom: var(--page-scale);
  scroll-padding-top: 92px;
  color-scheme: light;
  --bg-page: #f0f1f2;
  --bg-card: #ffffff;
  --bg-subtle: #f0f1f2;
  --bg-selected: #e0efff;
  --bg-hover: #f5f5f5;
  --text-primary: rgba(0, 0, 0, 0.9);
  --text-secondary: rgba(0, 0, 0, 0.62);
  --text-muted: rgba(0, 0, 0, 0.6);
  --accent: #0080ff;
  --accent-hover: #0070e0;
  --accent-text: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.12);
  --shadow-card: 0 2px 12px rgba(15, 23, 42, 0.04);
  --shadow-sheet: 0 18px 55px rgba(15, 23, 42, 0.18);
  --focus-ring: 0 0 0 3px rgba(0, 128, 255, 0.45);
  --radius-pill: 999px;
  --radius-card: 28px;
  --radius-item: 18px;
}

html[data-theme="night"] {
  color-scheme: dark;
  --bg-page: #000000;
  --bg-card: #1a1a1a;
  --bg-subtle: #333333;
  --bg-selected: rgba(26, 140, 255, 0.22);
  --bg-hover: #292929;
  --text-primary: rgba(255, 255, 255, 0.9);
  --text-secondary: rgba(255, 255, 255, 0.62);
  --text-muted: rgba(255, 255, 255, 0.6);
  --accent: #1a8cff;
  --accent-hover: #0878e8;
  --accent-text: #ffffff;
  --border-subtle: rgba(255, 255, 255, 0.2);
  --shadow-card: 0 4px 18px rgba(0, 0, 0, 0.28);
  --shadow-sheet: 0 18px 55px rgba(0, 0, 0, 0.48);
  --focus-ring: 0 0 0 3px rgba(26, 140, 255, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.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;
}

.page-shell {
  width: 100%;
  padding: 20px clamp(20px, 2.5vw, 48px) 48px;
}

/* 分层采样并逐段提高半径，避免用单一模糊的透明度渐变代替强度变化。 */
.top-blur {
  --blur-height: 128px;
  position: fixed;
  inset: 0 0 auto;
  height: var(--blur-height);
  z-index: 4;
  pointer-events: none;
}

.top-blur > span {
  position: absolute;
  inset: 0 0 auto;
  height: var(--end);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  /* 裁掉完全透明的尾部，渐变起点仍按完整高度定位。 */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(var(--blur-height) * var(--solid)), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(var(--blur-height) * var(--solid)), transparent);
}

.top-blur > span:nth-child(1) { --blur: 1px; --solid: 0.75; --end: 100%; }
.top-blur > span:nth-child(2) { --blur: 2px; --solid: 0.6; --end: 85%; }
.top-blur > span:nth-child(3) { --blur: 4px; --solid: 0.45; --end: 70%; }
.top-blur > span:nth-child(4) { --blur: 8px; --solid: 0.3; --end: 55%; }
.top-blur > span:nth-child(5) { --blur: 16px; --solid: 0.15; --end: 40%; }
.top-blur > span:nth-child(6) { --blur: 24px; --solid: 0; --end: 25%; }

/* 顶部导航栏 */
.top-nav {
  position: sticky;
  top: 20px;
  z-index: 5;
  width: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-card);
  border-radius: var(--radius-pill);
  padding: 8px 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 28px;
}

.brand {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.icons-page .top-nav {
  z-index: 6;
  transition: transform 0.2s ease, visibility 0s;
}

.icons-page.is-nav-hidden .top-nav {
  transform: translateY(calc(-100% - 32px));
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.2s ease, visibility 0s 0.2s;
}

.icons-page .search-section {
  position: sticky;
  top: 92px;
  z-index: 5;
  transition: top 0.2s ease;
}

.icons-page.is-nav-hidden .search-section {
  top: 20px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--text-primary);
  background-color: var(--bg-subtle);
}

.theme-segmented {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-pill);
}

.theme-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.theme-btn:hover {
  color: var(--text-primary);
}

.theme-btn.is-active {
  background-color: var(--accent);
  color: var(--accent-text);
}

.theme-btn:focus-visible,
.theme-toggle-btn:focus-visible,
.brand:focus-visible,
.nav-link:focus-visible,
.home-button:focus-visible,
.home-footer a:focus-visible,
.search-clear-btn:focus-visible,
.icon-card:focus-visible,
.detail-close-btn:focus-visible,
.reset-color-btn:focus-visible,
.swatch-btn:focus-visible,
.custom-color-input:focus-visible,
.copy-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.16s ease;
}

.theme-toggle-btn {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.theme-toggle-btn[hidden] {
  display: none;
}

.theme-toggle-btn svg {
  width: 22px;
  height: 22px;
}

.theme-toggle-btn:hover {
  background-color: var(--bg-subtle);
}

/* 首页与图标页共用导航和主题，首页只保留项目入口。 */
.home-shell {
  min-height: calc(100vh / var(--page-scale));
  min-height: calc(100svh / var(--page-scale));
  margin: 0 auto;
  padding-bottom: 24px;
  display: flex;
  flex-direction: column;
}

.home-shell .top-nav {
  margin-bottom: 0;
}

.home-main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 64px;
  align-items: center;
  padding: 80px 24px 104px;
}

.home-copy {
  min-width: 0;
}

.home-title {
  margin: 0;
  font-size: clamp(2.5rem, 4.5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.home-name {
  display: block;
  color: var(--accent);
  margin-bottom: 12px;
}

.home-tagline {
  display: block;
}

.home-art {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  isolation: isolate;
}

.home-art::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(130%, 480px);
  aspect-ratio: 1;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(153, 123, 234, 0.65), transparent 65%),
    radial-gradient(ellipse at 70% 70%, rgba(238, 113, 67, 0.55), transparent 65%);
  filter: blur(32px);
  pointer-events: none;
}

.home-logo {
  display: block;
  width: min(100%, 360px);
  height: auto;
}

.home-description {
  margin: 20px 0 0;
  font-size: 1.25rem;
  color: var(--text-secondary);
  line-height: 1.8;
  text-wrap: balance;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 30px;
}

.home-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 19px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.16s ease, transform 0.1s ease;
}

.home-button:hover {
  background-color: var(--bg-hover);
}

.home-button-primary {
  background-color: var(--accent);
  color: var(--accent-text);
}

.home-button-primary:hover {
  background-color: var(--accent-hover);
}

.home-button:active {
  transform: scale(0.97);
}

.home-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.home-footer p {
  margin: 0;
}

.home-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-pill);
}

.home-footer a:hover {
  color: var(--text-primary);
}

/* 标题区 */
.hero-header {
  margin: 0 8px 20px;
}

.page-title {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 4px 0 0;
  font-size: 1rem;
  color: var(--text-secondary);
}

/* 搜索栏与计数 */
.search-section {
  margin-bottom: 0;
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  border-radius: var(--radius-pill);
  padding: 12px 20px;
  box-shadow: var(--shadow-card);
  border: 1px solid transparent;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 12px;
}

.search-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  appearance: none;
  border: 0;
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 8px;
}

.search-clear-btn:hover {
  color: var(--text-primary);
}

.toolbar-meta {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 8px 0;
}

.icon-count {
  margin-left: auto;
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.grid-panel {
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
  min-height: 520px;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 14px;
}

.icon-card {
  appearance: none;
  border: 1px solid transparent;
  background-color: transparent;
  border-radius: var(--radius-item);
  padding: 18px 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background-color 0.15s ease, transform 0.12s ease;
  text-align: center;
  min-height: 118px;
  min-width: 0;
}

.icon-card:hover {
  background-color: var(--bg-hover);
}

.icon-card.is-selected {
  background-color: var(--bg-selected);
}

.icon-card-svg {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-card-svg svg,
.icon-card-svg img {
  width: 100%;
  height: 100%;
  display: block;
}

.icon-card-name {
  display: block;
  max-width: 100%;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.35;
  overflow-wrap: normal;
  word-break: normal;
}

.icon-card.is-selected .icon-card-name {
  color: var(--text-primary);
  font-weight: 600;
}

.empty-state {
  padding: 72px 20px;
  text-align: center;
  color: var(--text-secondary);
}

/* 右侧详情面板 */
.detail-panel {
  position: fixed;
  z-index: 10;
  top: 92px;
  right: clamp(20px, 2.5vw, 48px);
  width: min(420px, calc(100% - 40px));
  max-height: calc(100vh / var(--page-scale) - 112px);
  max-height: calc(100dvh / var(--page-scale) - 112px);
  overflow: hidden;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sheet);
  animation: detail-enter 0.2s ease-out;
}

.detail-panel[hidden] {
  display: none;
}

.detail-content {
  max-height: inherit;
  overflow-y: auto;
  scrollbar-width: none;
  overscroll-behavior: contain;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.detail-content::-webkit-scrollbar {
  display: none;
}

.detail-close-btn {
  position: absolute;
  z-index: 1;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}

.detail-close-btn:hover {
  color: var(--text-primary);
}

@keyframes detail-enter {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .detail-panel { animation: none; }
  *, *::before, *::after { transition: none !important; }
}

.detail-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 8px;
}

.detail-svg-container {
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.detail-svg-container svg,
.detail-svg-container img {
  width: 100%;
  height: 100%;
  display: block;
}

.detail-name {
  margin: 0;
  max-width: 100%;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: normal;
  word-break: normal;
}

.detail-subtitle {
  margin: 4px 0 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.variant-switch {
  margin-top: 12px;
}

.variant-switch[hidden] {
  display: none;
}

/* 颜色选择区 */
.color-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.color-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-label {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.reset-color-btn {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.reset-color-btn.is-active {
  background-color: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.color-mode-notice {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background-color: var(--bg-subtle);
  padding: 8px 12px;
  border-radius: 10px;
  line-height: 1.45;
}

.color-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.color-controls.is-disabled {
  opacity: 0.45;
}

.palette-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.palette-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.swatch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch-btn {
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.12);
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

html[data-theme="night"] .swatch-btn {
  border-color: rgba(255, 255, 255, 0.22);
}

.swatch-btn:hover:not(:disabled) {
  transform: scale(1.08);
}

.swatch-btn:disabled {
  cursor: not-allowed;
}

.swatch-btn.is-selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent);
}

.custom-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}

.custom-color-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.custom-color-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-subtle);
  padding: 4px 10px 4px 6px;
  border-radius: var(--radius-pill);
}

.custom-color-picker-wrap.is-selected {
  box-shadow: 0 0 0 2px var(--accent);
}

.custom-color-input {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
}

.custom-color-input:disabled {
  cursor: not-allowed;
}

.custom-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.custom-color-input::-webkit-color-swatch {
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
}

.custom-color-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text-primary);
}

/* 代码与复制区 */
.code-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.color-section[hidden],
.code-section[hidden] {
  display: none;
}

.copy-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.copy-btn {
  appearance: none;
  border: 0;
  width: 100%;
  background-color: var(--accent);
  color: var(--accent-text);
  font-size: 0.96rem;
  font-weight: 600;
  padding: 13px 20px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 0.16s ease, transform 0.1s ease;
}

.copy-btn:hover {
  background-color: var(--accent-hover);
}

.copy-btn:active {
  transform: scale(0.99);
}

.copy-feedback {
  margin: 0;
  font-size: 0.82rem;
  text-align: center;
  padding: 6px 10px;
  border-radius: 8px;
}

.copy-feedback.is-success {
  background-color: rgba(46, 194, 126, 0.15);
  color: #1c8854;
}

html[data-theme="night"] .copy-feedback.is-success {
  color: #53e09b;
}

.copy-feedback.is-error {
  background-color: rgba(235, 77, 61, 0.16);
  color: #c93326;
}

html[data-theme="night"] .copy-feedback.is-error {
  color: #ff7b6e;
}

/* 窄屏将标识放到文案上方，保留完整的项目介绍与操作入口。 */
@media (max-width: 960px) {
  .home-main {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 32px;
    padding: 56px 16px 72px;
    text-align: center;
  }

  .home-art {
    grid-row: 1;
    justify-self: center;
    width: min(100%, 280px);
  }

  .home-art::before {
    width: 125%;
  }

  .home-actions {
    justify-content: center;
  }
}

/* 响应式与手机布局 */
@media (max-width: 600px) {
  html {
    scroll-padding-top: 80px;
  }

  .page-shell {
    padding: 14px 14px 36px;
  }

  .top-blur {
    --blur-height: 112px;
  }

  .top-nav {
    top: 14px;
    padding: 6px 14px;
    margin-bottom: 20px;
  }

  .icons-page .search-section {
    top: 80px;
  }

  .icons-page.is-nav-hidden .search-section {
    top: 14px;
  }

  .brand {
    font-size: 1.08rem;
  }

  .theme-btn {
    padding: 5px 12px;
    font-size: 0.8rem;
  }

  .top-actions {
    gap: 4px;
  }

  .nav-link {
    padding: 0 10px;
  }

  .home-shell {
    padding-bottom: 16px;
  }

  .home-main {
    gap: 24px;
    padding: 40px 8px 56px;
  }

  .home-art {
    width: 200px;
  }

  .home-title {
    font-size: 2.25rem;
  }

  .home-description {
    max-width: 20em;
    margin-top: 20px;
    font-size: 1rem;
  }

  .home-button {
    padding-inline: 20px;
  }

  .page-title {
    font-size: 1.75rem;
  }

  .grid-panel {
    padding: 16px;
    border-radius: 22px;
  }

  .icon-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
  }

  .icon-card {
    padding: 14px 8px 12px;
    min-height: 102px;
  }

  .detail-panel {
    top: 78px;
    right: 12px;
    width: min(420px, calc(100% - 24px));
    max-height: calc(100vh / var(--page-scale) - 90px);
    max-height: calc(100dvh / var(--page-scale) - 90px);
    border-radius: 22px;
  }

  .detail-content {
    padding: 20px 18px;
  }
}
