:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-hover: #fafbfc;
  --text: #17191c;
  --muted: #777d87;
  --line: #e8eaee;
  --accent: #6f5cff;
  --accent-soft: #f0eeff;
  --sidebar-width: 232px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --shadow-hover: 0 14px 36px rgba(20, 24, 32, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

/* Sidebar */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 28px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 14px;
  line-height: 1.3;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-title {
  padding: 0 10px 10px;
  color: #9aa0a9;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.category-list {
  display: grid;
  gap: 4px;
}

.category-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  border: 0;
  border-radius: 10px;
  color: #555b64;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.category-button:hover {
  color: var(--text);
  background: #f5f6f8;
  transform: translateX(2px);
}

.category-button.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 650;
}

.category-count {
  min-width: 24px;
  color: #a2a7af;
  font-size: 11px;
  text-align: right;
}

.category-button.is-active .category-count {
  color: var(--accent);
}

/* Main */

.content {
  min-width: 0;
  padding: 46px clamp(28px, 4vw, 64px) 70px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.result-summary {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.search-box {
  width: min(430px, 48%);
  min-width: 280px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.search-box:focus-within {
  border-color: color-mix(in srgb, var(--accent), white 36%);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transform: translateY(-1px);
}

.search-box svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: #969ca5;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-box input::placeholder {
  color: #a5aab1;
}

.search-box kbd {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  color: #9298a1;
  background: #fbfbfc;
  font-size: 11px;
}

/* Icon grid */

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

.icon-card {
  position: relative;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 22px 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: inherit;
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  transition:
    transform 180ms cubic-bezier(.2,.8,.2,1),
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
  animation: cardIn 360ms both;
  animation-delay: calc(var(--i, 0) * 14ms);
}

.icon-card:hover {
  z-index: 1;
  transform: translateY(-4px);
  border-color: #d9dce2;
  background: var(--surface-hover);
  box-shadow: var(--shadow-hover);
}

.icon-card:active {
  transform: translateY(-1px) scale(0.985);
}

.icon-card.is-copied {
  border-color: color-mix(in srgb, var(--accent), white 30%);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.icon-preview {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  transition: transform 180ms cubic-bezier(.2,.8,.2,1);
}

.icon-card:hover .icon-preview {
  transform: scale(1.10);
}

.icon-preview img {
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain;
}

.icon-name {
  max-width: 100%;
  color: #515761;
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-button {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #666d76;
  background: rgba(255,255,255,.96);
  opacity: 0;
  transform: translateY(-5px) scale(.95);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.icon-card:hover .download-button,
.download-button:focus-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.download-button:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.download-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-hint {
  position: absolute;
  inset: auto 10px 9px;
  padding: 6px 8px;
  border-radius: 8px;
  color: #858b94;
  background: #f6f7f9;
  font-size: 10px;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  pointer-events: none;
}

.icon-card:hover .copy-hint {
  opacity: 1;
  transform: translateY(0);
}

.icon-card:hover .icon-name {
  transform: translateY(-8px);
}

.icon-name {
  transition: transform 160ms ease;
}

/* Empty */

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

.empty-symbol {
  margin-bottom: 14px;
  color: #b4b9c0;
  font-size: 40px;
}

.empty-state h2 {
  margin: 0 0 8px;
  color: #4e545d;
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border-radius: 12px;
  color: white;
  background: #17191c;
  box-shadow: 0 12px 34px rgba(0,0,0,.20);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px) scale(.97);
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(.2,.8,.2,1);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.toast-check {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #17191c;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 18px 18px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    padding-bottom: 16px;
  }

  .sidebar-title {
    display: none;
  }

  .category-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  .category-button {
    width: auto;
    flex: 0 0 auto;
    padding: 8px 11px;
    background: #f6f7f9;
  }

  .category-button:hover {
    transform: none;
  }

  .content {
    padding: 30px 18px 54px;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
    min-width: 0;
  }

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

  .icon-card {
    min-height: 132px;
  }

  .download-button {
    opacity: 1;
    transform: none;
  }
}
