:root {
  --bg: #090b10;
  --panel: rgba(18, 21, 29, 0.78);
  --panel-strong: #12151d;
  --panel-soft: #161a24;
  --text: #f4f6fb;
  --muted: #9299a8;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #ff8a1f;
  --accent-2: #ffc266;
  --success: #5ee6a8;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 138, 31, 0.08), transparent 26rem),
    radial-gradient(circle at 78% 18%, rgba(112, 87, 255, 0.07), transparent 26rem),
    var(--bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }

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

button { color: inherit; }

a { color: inherit; text-decoration: none; }

.glow {
  position: fixed;
  width: 340px;
  height: 340px;
  filter: blur(120px);
  opacity: 0.12;
  pointer-events: none;
  z-index: -1;
}

.glow-one { background: #ff8a1f; top: -120px; left: -80px; }
.glow-two { background: #7d65ff; top: 25%; right: -140px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 16, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #141414;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 24px rgba(255, 138, 31, .16);
  font-family: "JetBrains Mono", monospace;
  font-size: .78rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .7rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: .18s ease;
  font-weight: 650;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  color: #171717;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.btn-secondary {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.btn-ghost {
  border-color: var(--line);
  background: transparent;
}

.btn-ghost:hover,
.btn-secondary:hover {
  border-color: rgba(255, 138, 31, .38);
  background: rgba(255, 138, 31, .08);
}

.count-badge {
  min-width: 21px;
  height: 21px;
  padding: 0 .35rem;
  margin-left: .35rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  font-size: .75rem;
}

.hero {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(5rem, 11vw, 9rem) 0 4rem;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  padding: .42rem .72rem;
  border: 1px solid rgba(255, 138, 31, .26);
  border-radius: 999px;
  color: var(--accent-2);
  background: rgba(255, 138, 31, .07);
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.eyebrow.compact {
  padding: 0;
  border: 0;
  background: transparent;
}

.hero h1 {
  max-width: 860px;
  margin: 1.35rem auto .9rem;
  font-size: clamp(3rem, 8vw, 7.2rem);
  line-height: .92;
  letter-spacing: -.075em;
}

.hero h1 span {
  color: transparent;
  background: linear-gradient(120deg, #fff 5%, var(--accent-2) 45%, var(--accent) 80%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-copy {
  max-width: 680px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.hero-search-wrap {
  width: min(760px, 100%);
  margin: 2.2rem auto 0;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(18, 21, 29, .82);
  box-shadow: var(--shadow);
}

.hero-search-wrap:focus-within {
  border-color: rgba(255, 138, 31, .55);
  box-shadow: 0 0 0 4px rgba(255, 138, 31, .08), var(--shadow);
}

.hero-search-wrap svg {
  width: 22px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
}

.hero-search-wrap input {
  min-width: 0;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 1rem;
}

.hero-search-wrap input::placeholder { color: #6f7686; }

kbd {
  padding: .18rem .42rem;
  color: #aeb4c0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255,255,255,.04);
  font-family: "JetBrains Mono", monospace;
  font-size: .72rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(760px, 100%);
  margin: 2.6rem auto 0;
  border-top: 1px solid var(--line);
}

.stats > div {
  padding: 1.15rem .8rem;
  border-right: 1px solid var(--line);
}

.stats > div:last-child { border-right: 0; }

.stats strong {
  display: block;
  font-size: 1.35rem;
  letter-spacing: -.03em;
}

.stats span {
  color: var(--muted);
  font-size: .78rem;
}

.library {
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 6rem;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 2rem;
}

.filters {
  position: sticky;
  top: 92px;
  align-self: start;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(18, 21, 29, .66);
}

.filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.filter-heading h2 { margin: 0; font-size: 1rem; }

.filter-heading button {
  color: var(--accent-2);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: .8rem;
}

.select-label {
  display: block;
  margin: .9rem 0 .35rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 0 .75rem;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: #11141b;
}

select:focus { border-color: rgba(255, 138, 31, .55); }

.filter-note {
  margin-top: 1rem;
  padding-top: 1rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: .76rem;
}

.filter-note strong {
  display: block;
  margin-bottom: .35rem;
  color: var(--text);
}

.results-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.results-toolbar h2 {
  margin: .25rem 0 0;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  letter-spacing: -.045em;
}

.results-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
}

.snippet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.snippet-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(23,27,36,.96), rgba(16,19,26,.96));
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.snippet-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 138, 31, .24);
  box-shadow: 0 18px 55px rgba(0,0,0,.24);
}

.snippet-content { padding: 1rem 1rem .8rem; }

.snippet-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 650;
}

.snippet-number { color: var(--accent-2); }

.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #5c6270;
}

.snippet-card h3 {
  margin: .55rem 0 .35rem;
  font-size: 1.05rem;
  letter-spacing: -.025em;
}

.snippet-card p {
  min-height: 2.8em;
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
}

.code-frame {
  margin: 0 .65rem .65rem;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  background: #0d0f14;
}

.code-toolbar {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  padding: .45rem .65rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: #9aa2b1;
  font-size: .72rem;
}

.code-actions { display: flex; gap: .35rem; }

.code-action {
  padding: .34rem .55rem;
  color: #b7bdc9;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: .7rem;
}

.code-action:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255,255,255,.05);
}

.code-action.favorited { color: var(--accent-2); }

pre[class*="language-"],
code[class*="language-"] {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace !important;
  text-shadow: none !important;
}

pre[class*="language-"] {
  margin: 0 !important;
  max-height: 248px;
  padding: .9rem !important;
  background: #0d0f14 !important;
  font-size: .74rem !important;
  line-height: 1.65 !important;
}

.snippet-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .1rem 1rem .9rem;
}

.tag {
  display: inline-flex;
  max-width: 150px;
  padding: .26rem .5rem;
  overflow: hidden;
  color: #9ba3b2;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  font-size: .67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.open-snippet {
  color: var(--accent-2);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: .74rem;
  font-weight: 700;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding-top: 1.5rem;
}

.empty-state {
  padding: 5rem 1rem;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.empty-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 1rem;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  border-radius: 16px;
  background: rgba(255, 138, 31, .08);
  font-family: "JetBrains Mono", monospace;
}

.empty-state h3 { margin: 0 0 .4rem; }
.empty-state p { color: var(--muted); }

.snippet-modal {
  width: min(980px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow: hidden;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: #10131a;
  box-shadow: 0 30px 100px rgba(0,0,0,.55);
}

.snippet-modal::backdrop {
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
}

.modal-shell {
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.3rem 1.3rem .3rem;
}

.modal-header h2 {
  margin: .45rem 0 .35rem;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  letter-spacing: -.045em;
}

.modal-header p {
  margin: 0;
  color: var(--muted);
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  color: #bac0cb;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.03);
  cursor: pointer;
  font-size: 1.4rem;
}

.code-frame-large {
  margin: 1.2rem;
}

.code-frame-large pre[class*="language-"] {
  max-height: none;
  min-height: 300px;
  font-size: .83rem !important;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.2rem 1.2rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

footer {
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-brand { color: var(--text); }
footer p { margin: .9rem 0 0; font-size: .82rem; }

@media (max-width: 980px) {
  .header-actions .btn-ghost { display: none; }
  .library { grid-template-columns: 1fr; }
  .filters {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .7rem;
  }
  .filter-heading { grid-column: 1 / -1; margin-bottom: 0; }
  .select-label { display: none; }
  .filter-note { display: none; }
}

@media (max-width: 760px) {
  .site-header { padding-inline: 1rem; }
  .header-actions .btn-primary { display: none; }
  .hero { padding-top: 4rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div:nth-child(2) { border-right: 0; }
  .stats > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .snippet-grid { grid-template-columns: 1fr; }
  .results-toolbar { align-items: start; flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
  .modal-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 460px) {
  .brand { font-size: .9rem; }
  .brand-mark { width: 34px; height: 34px; }
  .hero { width: min(100% - 1.2rem, 1160px); }
  .library { width: min(100% - 1.2rem, 1440px); }
  .hero h1 { font-size: 3.35rem; }
  .hero-search-wrap { grid-template-columns: 20px 1fr; }
  .hero-search-wrap kbd { display: none; }
}
