@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@500;600;700&display=swap");

:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-hover: #fbfbfc;
  --ink: #181b21;
  --muted: #858b96;
  --line: #e5e7eb;
  --focus: #4f70e8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117;
    --surface: #171b23;
    --surface-hover: #1b2029;
    --ink: #f0f2f5;
    --muted: #89919e;
    --line: #292e38;
    --focus: #7893ff;
  }
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toolbox {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(24px, 6vh, 58px) 0 28px;
}

.utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.search-box {
  display: grid;
  width: min(320px, 100%);
  height: 40px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-box:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 13%, transparent);
}

.search-box svg {
  width: 16px;
  height: 16px;
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
}

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

kbd {
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  color: var(--muted);
  font: 500 0.62rem/1 "DM Mono", monospace;
}

.tool-count {
  color: var(--muted);
  font: 500 0.66rem/1 "DM Mono", monospace;
  text-transform: uppercase;
  white-space: nowrap;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.tool-card {
  --accent: #6276d9;
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 116px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.tool-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--surface-hover);
  box-shadow: 0 8px 22px rgba(20, 24, 32, 0.07);
  transform: translateY(-2px);
}

.tool-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 2px;
}

.tool-card[hidden] { display: none; }

.tool-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent);
}

.tool-icon svg {
  width: 19px;
  height: 19px;
}

.tool-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.tool-copy strong {
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-copy small {
  overflow: hidden;
  color: var(--muted);
  font: 400 0.57rem/1.2 "DM Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-arrow {
  width: 15px;
  height: 15px;
  color: var(--muted);
  opacity: 0.45;
  transition: opacity 150ms ease, transform 150ms ease;
}

.tool-card:hover .tool-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

.accent-violet { --accent: #7658e8; }
.accent-red { --accent: #e45a4f; }
.accent-blue { --accent: #3686dc; }
.accent-purple { --accent: #965ac7; }
.accent-orange { --accent: #df8621; }
.accent-gold { --accent: #c88d16; }
.accent-brown { --accent: #a56843; }
.accent-green { --accent: #63a03d; }
.accent-pink { --accent: #df5680; }
.accent-indigo { --accent: #5d70d9; }
.accent-teal { --accent: #209a91; }

.empty-state {
  margin: 0;
  padding: 52px 20px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 900px) {
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .toolbox {
    width: min(100% - 24px, 1120px);
    padding-top: 18px;
  }

  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .tool-card {
    min-height: 106px;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 13px;
  }

  .tool-icon { grid-column: 1 / 2; }
  .tool-copy { grid-column: 1 / -1; }
  .tool-arrow { position: absolute; top: 16px; right: 14px; }
}

@media (max-width: 390px) {
  .tool-count,
  kbd { display: none; }
  .search-box { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
