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

:root {
  --bg-primary: #080808;
  --bg-secondary: #111111;
  --bg-card: #141414;
  --bg-card-hover: #1a1a1a;
  --border: #222222;
  --border-hover: #333333;
  --text-primary: #e8e8e8;
  --text-secondary: #888888;
  --text-muted: #555555;
  --accent: #D4AF37;
  --accent-dim: rgba(212, 175, 55, 0.15);
  --accent-glow: rgba(212, 175, 55, 0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 8px;
  --radius-sm: 4px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: rgba(8, 8, 8, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.logo span {
  background: linear-gradient(135deg, #e8e8e8 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  min-width: 240px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
}

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

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 6px;
  padding: 20px 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-wrap: wrap;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.tab:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.tab.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.tab.active svg {
  opacity: 1;
}

/* Grid */
.cheatsheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}

/* Cards */
.cheatsheet-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.3s;
}

.cheatsheet-card:hover {
  border-color: var(--border-hover);
}

.cheatsheet-card.hidden {
  display: none;
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.card-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 8px 0;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.card-body::-webkit-scrollbar {
  width: 4px;
}

.card-body::-webkit-scrollbar-track {
  background: transparent;
}

.card-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Cheat Items */
.cheat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.12s;
  position: relative;
}

.cheat-item:last-child {
  border-bottom: none;
}

.cheat-item:hover {
  background: var(--bg-card-hover);
}

.cheat-item.hidden {
  display: none;
}

.cmd {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 140px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desc {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.cheat-item:hover .copy-btn {
  opacity: 1;
}

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

.copy-btn.copied {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.copy-btn.copied svg path {
  stroke: var(--accent);
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 15px;
}

/* Responsive */
@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    gap: 12px;
  }

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

  .cheatsheet-grid {
    grid-template-columns: 1fr;
  }

  .cmd {
    min-width: 110px;
    font-size: 12px;
  }

  .category-tabs {
    gap: 4px;
  }

  .tab {
    padding: 7px 10px;
    font-size: 12px;
  }

  .tab svg {
    width: 14px;
    height: 14px;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cheatsheet-card {
  animation: fadeIn 0.3s ease;
}

/* No results */
.no-results {
  display: none;
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 15px;
}

.no-results.visible {
  display: block;
}
