.snippets-main {
  padding-top: var(--navbar-height);
  min-height: 100dvh;
}

.snippets-container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
  padding-block: var(--space-10) var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.snippets-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.snippets-header__text h1 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-on-surface);
  letter-spacing: -0.02em;
}

.snippets-header__text p {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-muted);
}

.snippets-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  row-gap: var(--space-3);
}

.snippets-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.snippets-search {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  min-width: 220px;
  transition: border-color var(--transition-fast);
}

.snippets-search:focus-within {
  border-color: var(--color-muted-2);
}

.snippets-search .material-symbols-rounded {
  font-size: 16px;
  color: var(--color-muted);
  flex-shrink: 0;
}

.snippets-search input {
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-brand);
  font-size: var(--text-sm);
  color: var(--color-on-surface);
  width: 100%;
}

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

.sort-select {
  appearance: none;
  padding: var(--space-1) var(--space-6) var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-family: var(--font-brand);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border: 1px solid var(--color-border);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--color-muted);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.sort-select:hover {
  border-color: var(--color-muted-2);
  color: var(--color-on-surface);
}

.snippets-langs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.lang-chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-family: var(--font-brand);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.lang-chip:hover {
  color: var(--color-on-surface);
  border-color: var(--color-muted-2);
}

.lang-chip--active {
  background-color: var(--color-on-surface);
  color: var(--color-bg);
  border-color: var(--color-on-surface);
}

.snippets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

@keyframes shimmer {
  0% {
    background-position: -600px 0;
  }

  100% {
    background-position: 600px 0;
  }
}

.skeleton {
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-surface-raised) 50%, var(--color-surface) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
  min-height: 220px;
}

.snippet-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface);
  overflow: hidden;
  cursor: pointer;
  max-height: 380px;
  transition: border-color var(--transition-base);
}

.snippet-card:hover {
  border-color: var(--color-muted-2);
}

.snippet-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border-subtle);
}

.snippet-card__lang-dot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.lang-dot {
  display: none;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.snippet-card__lang-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-muted);
  letter-spacing: 0.04em;
}

.snippet-card__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.snippet-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-muted-2);
  transition: color var(--transition-fast);
  padding: var(--space-1);
}

.snippet-icon-btn:hover {
  color: var(--color-on-surface);
}

.snippet-icon-btn.liked,
.snippet-icon-btn.liked:hover {
  color: #ef4444;
}

.snippet-icon-btn .material-symbols-rounded {
  font-size: 16px;
}

.snippet-card__preview {
  padding: var(--space-4) var(--space-5);
  background-color: var(--color-bg);
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  line-height: 1.7;
  color: var(--color-muted);
  max-height: 120px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  border-bottom: 1px solid var(--color-border-subtle);
  white-space: pre;
}

.snippet-card__body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
}

.snippet-card__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-on-surface);
}

.snippet-card__desc {
  font-size: var(--text-xs);
  color: var(--color-muted);
  font-weight: var(--weight-regular);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.snippet-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border-subtle);
}

.snippet-card__author {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.snippet-card__avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background-color: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: var(--weight-bold);
  color: var(--color-muted);
  overflow: hidden;
}

.snippet-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.snippet-card__username {
  font-size: var(--text-xs);
  color: var(--color-muted);
  font-weight: var(--weight-medium);
}

.snippet-card__stats {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.snippet-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  color: var(--color-muted-2);
  font-weight: var(--weight-medium);
}

.snippet-stat .material-symbols-rounded {
  font-size: 13px;
}

.snippets-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-16) var(--space-4);
  color: var(--color-muted);
}

.snippets-empty.visible {
  display: flex;
}

.snippets-empty .material-symbols-rounded {
  font-size: 40px;
  color: var(--color-muted-2);
}

.snippets-empty p {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

@media (max-width: 900px) {
  .snippets-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .snippets-header {
    flex-direction: column;
    align-items: flex-start;
  }

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

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