:root {
  --control-height: 52px;
  --search-height: 60px;
}

html,
body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html {
  height: 100%;
  overflow: auto !important;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  margin: 0;
  padding: 0;
  background-color: #f4f6fb;
  overflow: visible !important;
  color: #111827;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.browse-main {
  flex: 1;
  margin: 0;
  padding: 2%;
  width: 100%;
  box-sizing: border-box;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-kicker {
  margin: 0 0 0.35rem 0;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 700;
}

.page-title {
  font-size: 2rem;
  color: #0f172a;
  margin: 0;
}

.search-container {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
}

.search-stack {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-input {
  width: 100%;
  height: var(--search-height);
  padding: 0 1rem;
  padding-left: 2.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background-color: #ffffff;
  font-size: 0.95rem;
  color: #1f2937;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.85rem center;
  background-size: 1rem 1rem;
}

.search-input:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.search-input::placeholder {
  color: #9ca3af;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem;
  background-color: #e5e7eb;
  border-radius: 999px;
  min-height: var(--control-height);
}

.view-button {
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  color: #374151;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.view-button img {
  width: 20px;
  height: 20px;
  display: block;
}

.view-button:hover {
  color: #0f172a;
}

.view-button.is-active {
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

.grid-section {
  margin-bottom: 2rem;
}

.grid-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 3.5rem;
}

.pagination-button {
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.pagination-button:hover,
.pagination-button:focus-visible {
  transform: translateY(-1px);
  border-color: #7dd3fc;
  box-shadow: 0 12px 26px rgba(14, 165, 233, 0.18);
  outline: none;
}

.pagination-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pagination-label {
  color: #4b5563;
  font-weight: 600;
  font-size: 0.95rem;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(220px, 1fr));
  row-gap: 2.5rem;
  column-gap: 0.5rem;
}

.set-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.9rem;
  background: #ffffff;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  height: 100%;
  position: relative;
}

.set-card--selected {
  border-color: #2563eb;
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.16);
  background: linear-gradient(135deg, #f8fbff, #eef2ff);
}

.set-card:hover,
.set-card:focus-visible {
  transform: none;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15), 0 12px 28px rgba(37, 99, 235, 0.15);
  border-color: #7dd3fc;
  background: #f8fafc;
  outline: none;
}

.set-card__select {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
  z-index: 5;
  cursor: pointer;
}

.set-card__checkbox {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.set-card__checkbox:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.set-card__checkbox:checked {
  border-color: #2563eb;
  background: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.set-card__check {
  position: absolute;
  width: 10px;
  height: 6px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.set-card__checkbox:checked + .set-card__check {
  opacity: 1;
}

.set-card__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0.75rem;
  background: radial-gradient(circle at 25% 25%, #ecfeff, #bae6fd);
  border: 1px solid #e5e7eb;
  overflow: hidden;
  position: relative;
}
.set-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.set-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  text-align: center;
  flex: 1;
}

.set-card__footer {
  display: flex;
  justify-content: center;
}

.edit-icon-link {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  z-index: 10;
}

.edit-icon-link:hover,
.edit-icon-link:focus {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  transform: scale(1.1);
  outline: none;
}

.edit-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.table-edit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e0f2fe;
  border: 1px solid #0ea5e9;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}

.table-edit-icon:hover,
.table-edit-icon:focus {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  transform: scale(1.05);
  outline: none;
}

.edit-link,
.table-edit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid #0ea5e9;
  color: #0ea5e9;
  font-weight: 700;
  text-decoration: none;
  background: #e0f2fe;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.edit-link:hover,
.edit-link:focus,
.table-edit-link:hover,
.table-edit-link:focus {
  color: #0f172a;
  background: #bae6fd;
  border-color: #0284c7;
  outline: none;
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.25);
}

.set-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.set-card__title-link {
  color: inherit;
  text-decoration: none;
}

.set-card__title-link:hover,
.set-card__title-link:focus-visible {
  color: #0ea5e9;
  outline: none;
}

.set-card__description {
  margin: 0;
  color: #4b5563;
  font-size: 0.95rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.set-card--empty {
  background: #f8fafc;
  border-style: dashed;
  color: #6b7280;
  cursor: default;
}

.grid-placeholder {
  grid-column: 1 / -1;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 0.9rem;
  padding: 2rem;
  text-align: center;
  color: #6b7280;
}

.table-section[hidden] {
  display: none;
}

.table-container {
  background-color: #ffffff;
  border-radius: 0.9rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  overflow-x: auto;
  border: 1px solid #e5e7eb;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: inherit;
}

thead {
  background-color: #0f172a;
  color: #ffffff;
}

th {
  font-size: 0.95rem;
  padding: 0.95rem 1rem;
  text-align: left;
  font-weight: 700;
}

tbody tr {
  border-bottom: 1px solid #e5e7eb;
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background-color: #f8fafc;
}

tbody tr:last-child {
  border-bottom: none;
}

.table-row--selected {
  background-color: #eef2ff;
}

td {
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  color: #1f2937;
  vertical-align: top;
}

td:first-child {
  width: 46px;
}

.table-select-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.set-name-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.set-thumb {
  width: 52px;
  height: 52px;
  border-radius: 0.65rem;
  background: radial-gradient(circle at 30% 30%, #ecfeff, #bae6fd);
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
  overflow: hidden;
  position: relative;
}
.set-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.set-link {
  color: #0ea5e9;
  text-decoration: none;
  font-weight: 700;
  transition: color 0.3s ease, outline-color 0.3s ease;
}

.set-link:hover,
.set-link:focus {
  color: #0284c7;
  outline: 2px solid #bae6fd;
  outline-offset: 2px;
  border-radius: 2px;
}

.loading,
.empty-message,
.error-message {
  text-align: center;
  color: #6b7280;
  padding: 2rem;
}

.error-message {
  color: #dc2626;
}

@media (max-width: 1200px) {
  .set-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(auto-fill, minmax(220px, 1fr));
    row-gap: 1.5rem;
    column-gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .browse-main {
    padding: 2%;
  }

  .page-title {
    font-size: 1.5rem;
  }

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

  .search-container {
    max-width: 100%;
    order: 2;
  }

  .view-toggle {
    order: 3;
    align-self: flex-end;
  }

  .set-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(auto-fill, minmax(220px, 1fr));
    row-gap: 1.5rem;
    column-gap: 1.5rem;
  }
}
