﻿:root {
  --bg:             #080b12;
  --bg-header:      rgba(8, 11, 18, 0.96);
  --surface:        #0f1520;
  --surface-hover:  #162033;
  --border:         #1c2740;
  --border-hover:   #2d3f5e;

  --accent:         #7c5cfc;
  --accent-hover:   #6b4af0;
  --accent-dim:     rgba(124, 92, 252, 0.12);
  --accent-glow:    rgba(124, 92, 252, 0.25);

  --text:           #e2e8f0;
  --text-dim:       #8499b5;
  --text-muted:     #384a63;

  --star:           #fbbf24;
  --star-dim:       rgba(251, 191, 36, 0.12);
  --success:        #34d399;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --transition: 140ms ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  
  background-image:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(124,92,252,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(56,139,253,0.04) 0%, transparent 50%);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

[hidden] { display: none !important; }

.container {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-icon {
  width: 34px;
  height: 34px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1;
  white-space: nowrap;
}

.search-wrapper {
  flex: 1;
  position: relative;
  max-width: 640px;
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.6rem 1rem 0.6rem 2.65rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

#searchInput::placeholder { color: var(--text-muted); }
#searchInput::-webkit-search-cancel-button { cursor: pointer; }

.btn-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-toggle:hover {
  border-color: var(--star);
  color: var(--star);
}
.btn-toggle.active {
  background: var(--star-dim);
  border-color: var(--star);
  color: var(--star);
}

.badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1em 0.5em;
  border-radius: 999px;
  min-width: 1.5em;
  text-align: center;
  line-height: 1.5;
}

.stats-bar {
  background: rgba(15, 21, 32, 0.7);
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0;
}

.stats-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-show-all {
  margin-left: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.22rem 0.7rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-show-all:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.main-content {
  flex: 1;
  padding-top: 1.75rem;
  padding-bottom: 2rem;
  max-width: 100%;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 5rem 1rem;
  text-align: center;
  color: var(--text-dim);
}
.state svg { opacity: 0.35; }

.state-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}
.state-desc {
  font-size: 0.88rem;
  color: var(--text-dim);
  max-width: 380px;
}
.state-desc strong { color: var(--accent); }

.loader { display: flex; align-items: center; justify-content: center; }
.loader-ring {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  transition: all var(--transition);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.object-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
}

@media (max-width: 520px) {
  .object-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
  }
}
@media (min-width: 521px) and (max-width: 900px) {
  .object-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.9rem;
  }
}
@media (min-width: 1500px) {
  .object-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.card.is-favorite {
  border-color: rgba(251, 191, 36, 0.28);
}
.card.is-favorite:hover {
  border-color: rgba(251, 191, 36, 0.55);
}

.card-img {
  position: relative;
  padding-top: 100%; 
  background: linear-gradient(
    150deg,
    hsl(var(--hue, 240), 38%, 13%) 0%,
    hsl(var(--hue, 240), 22%, 8%)  100%
  );
  overflow: hidden;
}

.card-img.card-img--local {
  background: linear-gradient(150deg, #0d2e5a 0%, #0a1f3e 100%);
}

.card-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 2;
}

.card-img img.img-loaded {
  opacity: 1;
}

.card-img img.img-loaded ~ .card-placeholder {
  display: none;
}

.card-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 1;
  pointer-events: none;
}

.card-placeholder svg {
  color: hsl(var(--hue, 240), 55%, 55%);
  opacity: 0.6;
}

.card-placeholder small {
  font-size: 0.58rem;
  color: hsl(var(--hue, 240), 25%, 45%);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  opacity: 0.7;
  text-align: center;
  line-height: 1.4;
  padding: 0 8px;
}

.card-body {
  padding: 0.55rem 0.7rem 0.7rem;
  border-top: 1px solid var(--border);
}

.card-name {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.card-actions {
  display: flex;
  gap: 0.35rem;
}

.btn-copy {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  background: var(--accent-dim);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.32rem 0;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-copy:hover {
  background: var(--accent);
  color: #fff;
}
.btn-copy.copied {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.3);
}

.btn-fav {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.32rem 0.5rem;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-fav:hover {
  border-color: var(--star);
  color: var(--star);
  background: var(--star-dim);
}
.btn-fav.active {
  color: var(--star);
  border-color: rgba(251, 191, 36, 0.4);
  background: var(--star-dim);
}

.pagination-nav {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  background: rgba(8, 11, 18, 0.7);
}

.pagination-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.page-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all var(--transition);
}
.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: center;
}

.page-num {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0 0.4rem;
}
.page-num:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.page-num.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 10px var(--accent-glow);
}

.page-dots {
  color: var(--text-muted);
  padding: 0 0.1rem;
  user-select: none;
}

.toast {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%) translateY(140%);
  opacity: 0;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.6rem 1.2rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.32s ease;
  z-index: 999;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  background: var(--surface);
  margin-top: auto;
}
.footer-inner {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.footer-inner a {
  color: var(--text-dim);
}
.footer-inner a:hover {
  color: var(--accent);
}

.categories-bar {
  background: rgba(8, 11, 18, 0.9);
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0 0;
}

.categories-scroll {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.55rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
}
.categories-scroll::-webkit-scrollbar { height: 3px; }
.categories-scroll::-webkit-scrollbar-track { background: transparent; }
.categories-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.28rem 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.5;
}
.cat-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.cat-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-glow);
}
.cat-count {
  font-size: 0.66rem;
  opacity: 0.65;
  font-weight: 400;
}
.cat-chip.active .cat-count { opacity: 0.85; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(18px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 780px;
  position: relative;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.75);
  animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 3;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  transition: all var(--transition);
}
.modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.modal-img {
  position: relative;
  height: 500px;
  background: linear-gradient(
    150deg,
    hsl(var(--hue, 240), 38%, 13%) 0%,
    hsl(var(--hue, 240), 22%, 8%)  100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}
.modal-preview.img-loaded { opacity: 1; }

.modal-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.modal-placeholder svg {
  color: hsl(var(--hue, 240), 60%, 65%);
  opacity: 0.55;
  filter: drop-shadow(0 0 18px hsl(var(--hue, 240), 70%, 35%));
}
.modal-placeholder span {
  font-size: 0.75rem;
  color: hsl(var(--hue, 240), 30%, 50%);
  font-family: var(--font-mono);
}

.modal-body {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

.modal-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 0.9rem;
  word-break: break-all;
  line-height: 1.5;
  user-select: all;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.modal-btn-copy {
  flex: 1;
  min-width: 90px;
  justify-content: center;
  gap: 0.4rem;
}

.modal-btn-fav {
  background: var(--star-dim);
  color: var(--star);
  border: 1px solid rgba(251, 191, 36, 0.3);
  gap: 0.4rem;
  flex-shrink: 0;
}
.modal-btn-fav:hover {
  background: var(--star);
  color: #000;
}
.modal-btn-fav.active {
  background: var(--star);
  color: #000;
  border-color: var(--star);
}

.modal-btn-forge {
  background: var(--surface-hover);
  color: var(--text-dim);
  border: 1px solid var(--border);
  gap: 0.4rem;
  text-decoration: none;
  flex-shrink: 0;
}
.modal-btn-forge:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

@media (max-width: 600px) {
  .modal-img { height: 300px; }
  .modal-actions { gap: 0.4rem; }
}

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .search-wrapper {
    order: 3;
    max-width: 100%;
    width: 100%;
    flex: none;
  }
  .btn-toggle span:not(.badge) {
    display: none;
  }
  .brand-sub {
    display: none;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .stats-inner { font-size: 0.75rem; }
  .page-btn { padding: 0.45rem 0.75rem; font-size: 0.8rem; }
}
