:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top right, #1e1b4b, #0f172a 45%, #020617);
  color: #e2e8f0;
}

.container {
  width: min(1640px, 98%);
  margin: 20px auto 28px;
}

.top-links {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #334155;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
  padding: 8px 12px;
  background: rgba(2, 6, 23, 0.88);
  font-size: 0.88rem;
}

.top-link:hover {
  border-color: #6366f1;
  color: #e2e8f0;
}

.hero {
  background: rgba(2, 6, 23, 0.88);
  border: 1px solid #1f2937;
  border-radius: 16px;
  padding: 18px;
}

.hero h1 {
  margin: 0 0 6px;
  color: #f8fafc;
}

.hero p {
  margin: 0;
  color: #94a3b8;
}

.stats {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.stats div {
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 10px;
  background: #020617;
}

.stats span {
  display: block;
  color: #94a3b8;
  font-size: 0.8rem;
}

.stats strong {
  color: #c4b5fd;
  font-size: 1.1rem;
}

.toolbar {
  margin-top: 12px;
  background: rgba(2, 6, 23, 0.88);
  border: 1px solid #1f2937;
  border-radius: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(320px, 2.2fr) repeat(4, minmax(170px, 1fr)) minmax(210px, 1.2fr) minmax(170px, 1fr);
  gap: 8px;
}

input,
select,
button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #020617;
  color: #e2e8f0;
  padding: 10px 11px;
  font-size: 0.92rem;
}

input:focus,
select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
  outline: none;
}

button {
  border: none;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.06);
}

.legend {
  margin-top: 12px;
  border: 1px solid #1f2937;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(2, 6, 23, 0.88);
  font-size: 0.88rem;
}

.az-nav {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.az-nav button {
  width: auto;
  min-width: 34px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.82rem;
}

.az-nav button.off {
  opacity: 0.45;
  cursor: not-allowed;
}

.results-info {
  margin: 12px 2px 6px;
  color: #94a3b8;
  font-size: 0.86rem;
}

.catalog-layout {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 14px;
  align-items: start;
}

.catalog-main {
  min-width: 0;
}

.breed-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.breed-card {
  background: #020617;
  border: 1px solid #1f2937;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.breed-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
  border: 1px solid #1f2937;
  margin-bottom: 8px;
  background: #0b1220;
}

.breed-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: #a5b4fc;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag {
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 2px 8px;
  color: #cbd5e1;
  font-size: 0.75rem;
}

.breed-card p {
  margin: 4px 0;
  font-size: 0.86rem;
  color: #cbd5e1;
}

.breed-card .btn-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.breed-card .btn-row.btn-row-full {
  grid-template-columns: 1fr;
  margin-top: auto;
  padding-top: 8px;
  margin-left: -12px;
  margin-right: -12px;
  margin-bottom: -12px;
}

.breed-card .btn-row.btn-row-full button {
  border-radius: 0 0 14px 14px;
  white-space: nowrap;
}

.empty-state {
  display: none;
  margin-top: 10px;
  color: #fca5a5;
}

.compare-panel {
  border: 1px solid #1f2937;
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.88);
  padding: 12px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.compare-panel h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: #f8fafc;
}

.compare-panel p {
  margin: 0 0 10px;
  color: #94a3b8;
  font-size: 0.88rem;
}

.compare-selected {
  min-height: 24px;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compare-chip {
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid #4f46e5;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  color: #c7d2fe;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.compare-chip-remove {
  width: auto;
  border: 1px solid #6366f1;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 0.72rem;
  line-height: 1.2;
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(99, 102, 241, 0.28);
  cursor: pointer;
}

.compare-chip-remove:hover {
  filter: brightness(1.08);
}

.table-wrap {
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.compare-table th,
.compare-table td {
  border: 1px solid #1f2937;
  padding: 8px;
  text-align: left;
  vertical-align: top;
  font-size: 0.84rem;
  color: #cbd5e1;
}

.compare-table thead th {
  background: #111827;
  color: #e2e8f0;
}

.compare-table tbody th {
  width: 180px;
  background: #0b1220;
  color: #a5b4fc;
}

.compare-stack {
  display: none;
  gap: 8px;
}

.compare-breed-card {
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 9px;
  background: #0b1220;
}

.compare-breed-card h3 {
  margin: 0 0 8px;
  color: #c4b5fd;
  font-size: 0.94rem;
}

.compare-stack-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 1.3fr;
  gap: 8px;
  padding: 4px 0;
  border-top: 1px solid #1f2937;
}

.compare-stack-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.compare-stack-row strong {
  color: #94a3b8;
  font-size: 0.78rem;
}

.compare-stack-row span {
  color: #e2e8f0;
  font-size: 0.8rem;
}

.breed-hero-image {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
  border: 1px solid #334155;
  margin-top: 12px;
  background: #0b1220;
}

.breed-dialog {
  width: min(920px, 95%);
  border: 1px solid #334155;
  border-radius: 14px;
  background: #020617;
  color: #e2e8f0;
}

.breed-dialog::backdrop {
  background: rgba(2, 6, 23, 0.76);
}

.breed-dialog article {
  padding: 14px;
}

.breed-dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.breed-dialog header h2 {
  margin: 0;
  color: #c4b5fd;
  font-size: 1.2rem;
}

.breed-dialog header button {
  width: auto;
  padding: 8px 12px;
  border-radius: 8px;
}

.dialog-content {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px;
}

.dialog-item {
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.9);
}

.dialog-item strong {
  display: block;
  font-size: 0.82rem;
  color: #e2e8f0;
}

.dialog-item span {
  display: block;
  margin-top: 4px;
  font-size: 0.84rem;
  color: #cbd5e1;
}

.editorial {
  margin-top: 16px;
}

.editorial-section {
  background: rgba(2, 6, 23, 0.88);
  border: 1px solid #1f2937;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.editorial-section h2 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  color: #c4b5fd;
}

.editorial-section p {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.72;
  color: #cbd5e1;
}

.image-credit {
  margin: 6px 0 0;
  font-size: 0.76rem;
  color: #64748b;
}

.image-credit a {
  color: #818cf8;
  text-decoration: none;
}

.image-credit a:hover {
  text-decoration: underline;
}

.site-footer {
  margin-top: 28px;
  padding: 16px 0;
  border-top: 1px solid #1f2937;
  text-align: center;
  font-size: 0.82rem;
  color: #64748b;
}

.site-footer a {
  color: #818cf8;
  text-decoration: none;
  margin: 0 6px;
}

.site-footer a:hover {
  text-decoration: underline;
}

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #111827;
  border-top: 1px solid #334155;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  z-index: 9999;
  font-size: 0.88rem;
  color: #cbd5e1;
}

.cookie-banner.hidden {
  display: none;
}

.cookie-banner a {
  color: #818cf8;
}

.cookie-banner button {
  width: auto;
  padding: 8px 18px;
  font-size: 0.86rem;
}

@media (max-width: 1120px) {
  .toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .breed-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .catalog-layout {
    grid-template-columns: 1fr;
  }
  .compare-panel {
    position: static;
    top: auto;
    max-height: none;
    margin-top: 14px;
  }
}

@media (max-width: 920px) {
  .breed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 740px) {
  .stats {
    grid-template-columns: 1fr;
  }
  .toolbar {
    grid-template-columns: 1fr;
  }
  .dialog-content {
    grid-template-columns: 1fr;
  }
  .breed-grid {
    grid-template-columns: 1fr;
  }
  .breed-card .btn-row {
    grid-template-columns: 1fr;
  }
}
