:root {
  color-scheme: dark;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bg: #08090d;
  --panel: rgba(18, 20, 28, 0.9);
  --panel-soft: rgba(24, 27, 38, 0.72);
  --panel-hover: #1c202c;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #f6f7fb;
  --muted: #a0a6b5;
  --subtle: #737b8e;
  --accent: #ff4f77;
  --accent-2: #ff8a24;
  --cyan: #74e8ff;
  --green: #5ce3a2;
  --danger: #ff6b7d;
  --focus: #8be9ff;
  --radius: 16px;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; }
input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  outline: 0;
}
input { padding: 0.65rem 0.75rem; }
select { padding: 0.6rem 2rem 0.6rem 0.75rem; }
input:focus, select:focus, button:focus-visible, a:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(116, 232, 255, 0.18);
  outline: none;
}
input::placeholder { color: #697185; }

.glass-bg {
  position: fixed;
  inset: -30vh -20vw auto auto;
  z-index: -1;
  width: 75vw;
  height: 75vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 79, 119, 0.13), rgba(255, 138, 36, 0.035) 48%, transparent 70%);
  filter: blur(45px);
  pointer-events: none;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 9, 13, 0.86);
  backdrop-filter: blur(18px);
}
.header-container {
  display: flex;
  max-width: 1480px;
  min-height: 88px;
  margin: 0 auto;
  padding: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.brand { display: flex; align-items: center; gap: 0.9rem; text-decoration: none; }
.title-sub { display: flex; flex-direction: column; }
.brand-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  color: transparent;
}
.subtitle { color: var(--muted); font-size: 0.82rem; }
.vinyl-spinner-container { width: 48px; height: 48px; flex: 0 0 48px; }
.vinyl-record-icon {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #050505 0 4px, #191b22 5px 6px, #050505 7px 9px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.65);
  animation: spin 3.5s linear infinite paused;
}
.vinyl-record-icon.spinning { animation-play-state: running; }
.vinyl-label {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transform: translate(-50%, -50%);
}
.vinyl-label::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: #111; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-panel { display: grid; grid-template-columns: auto auto; align-items: center; gap: 0.25rem 1rem; }
.status-meta { display: flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; }
.status-indicator-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); box-shadow: 0 0 8px currentColor; }
.status-indicator-dot.online { background: var(--green); color: var(--green); }
.status-indicator-dot.scraping { background: var(--cyan); color: var(--cyan); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.status-text { font-weight: 600; }
.status-time { grid-column: 1; color: var(--subtle); font-size: 0.72rem; }
.progress-bar-container { grid-column: 1; width: 100%; height: 4px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.08); }
.progress-bar-fill { width: 25%; height: 100%; background: linear-gradient(90deg, var(--cyan), #4ca8ff); transition: width 0.25s; }

.btn {
  display: inline-flex;
  min-height: 42px;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
  transition: transform 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 25px rgba(255, 79, 119, 0.22); }
.btn-secondary { border-color: var(--border); background: rgba(255, 255, 255, 0.045); }
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); background: rgba(255, 255, 255, 0.075); }
.btn-text { min-height: auto; padding: 0.25rem; border: 0; background: transparent; color: var(--accent); }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.icon-button { width: 42px; height: 42px; padding: 9px; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--text); }
.icon-button svg { width: 100%; height: 100%; }

.main-content { max-width: 1480px; margin: 0 auto; padding: 1.5rem 2rem 4rem; }
.search-toolbar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto minmax(190px, 230px) 105px;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.search-box { position: relative; }
.search-box input { height: 48px; padding-left: 2.75rem; background: rgba(255, 255, 255, 0.06); font-size: 1rem; }
.search-icon { position: absolute; top: 14px; left: 0.9rem; width: 20px; color: var(--muted); }
.toolbar-select { display: grid; grid-template-columns: auto; gap: 0.2rem; }
.toolbar-select label { color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.toolbar-select select { min-height: 30px; height: 30px; padding-block: 0; border: 0; background-color: transparent; font-weight: 600; }
.filter-toggle { display: none; }
.filter-count { min-width: 21px; height: 21px; padding: 0 5px; border-radius: 99px; background: var(--accent); font-size: 0.72rem; line-height: 21px; }

.active-filter-row { display: flex; margin: 0 0 1rem; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.active-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filter-chip { display: inline-flex; padding: 0.42rem 0.55rem 0.42rem 0.7rem; border: 1px solid var(--border); border-radius: 99px; align-items: center; gap: 0.4rem; background: var(--panel-soft); color: #dde1ec; font-size: 0.78rem; }
.filter-chip button { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.08); color: inherit; line-height: 18px; }

.catalog-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 2rem; align-items: start; }
.filter-panel {
  position: sticky;
  top: 112px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  scrollbar-color: #3b4050 transparent;
}
.filter-panel-header { display: flex; padding: 1.15rem; border-bottom: 1px solid var(--border); align-items: center; justify-content: space-between; }
.filter-panel-header h2 { margin: 0.1rem 0 0; font-size: 1.3rem; }
.filter-panel-header .icon-button { display: none; }
.eyebrow { color: var(--accent); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.filter-section { margin: 0; padding: 1.1rem; border: 0; border-bottom: 1px solid var(--border); }
.filter-section legend, .filter-section h2 { margin: 0 0 0.8rem; color: #e9ebf2; font-size: 0.8rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.quick-filter-section { display: grid; gap: 0.65rem; }
.toggle-row { display: grid; grid-template-columns: auto 1fr auto; gap: 0.55rem; align-items: center; color: #daddE7; font-size: 0.86rem; cursor: pointer; }
.toggle-row input { width: 17px; min-height: 17px; height: 17px; accent-color: var(--accent); }
.toggle-row small { color: var(--subtle); }
.range-inputs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0.45rem; align-items: end; }
.range-inputs label, .stacked-control { display: grid; gap: 0.35rem; color: var(--muted); font-size: 0.72rem; }
.range-divider { padding-bottom: 0.7rem; color: var(--subtle); font-size: 0.72rem; }
.money-input, .suffix-input { position: relative; display: flex; align-items: center; }
.money-input > span:first-child { position: absolute; left: 0.65rem; color: var(--subtle); }
.money-input input { padding-left: 1.35rem; }
.suffix-input > span:last-child { position: absolute; right: 0.65rem; color: var(--subtle); }
.suffix-input input { padding-right: 1.4rem; }
.stacked-control + .stacked-control, .range-inputs + .stacked-control { margin-top: 0.7rem; }
.mini-search { display: block; margin-bottom: 0.65rem; }
.mini-search input { min-height: 36px; height: 36px; font-size: 0.82rem; }
.facet-options { display: grid; gap: 0.5rem; }
.facet-option { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.5rem; align-items: center; font-size: 0.82rem; cursor: pointer; }
.facet-option input { width: 16px; min-height: 16px; height: 16px; accent-color: var(--accent); }
.facet-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet-option small { color: var(--subtle); font-size: 0.72rem; }
.facet-more { margin-top: 0.7rem; padding: 0; border: 0; background: transparent; color: var(--cyan); font-size: 0.76rem; font-weight: 650; }
.facet-empty { color: var(--subtle); font-size: 0.78rem; }
.mobile-filter-actions { display: none; }
.filter-backdrop { display: none; }

.results-panel { min-width: 0; }
.results-heading-row { display: flex; margin: 0.35rem 0 1.2rem; align-items: flex-end; justify-content: space-between; gap: 1.5rem; }
.results-heading-row h1 { margin: 0.15rem 0 0; font-size: clamp(1.65rem, 3vw, 2.3rem); letter-spacing: -0.035em; }
.count-display { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; }
.metadata-note { max-width: 310px; margin: 0; color: var(--subtle); font-size: 0.75rem; text-align: right; }
.records-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }
.record-card {
  position: relative;
  display: flex;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-direction: column;
  background: var(--panel-soft);
  transition: transform 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.record-card:hover { border-color: var(--border-strong); background: var(--panel-hover); box-shadow: var(--shadow); transform: translateY(-4px); }
.card-art-wrapper { position: relative; aspect-ratio: 1; overflow: hidden; background: #12141c; }
.card-art { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.record-card:hover .card-art { transform: scale(1.025); }
.discount-badge, .choice-badge { position: absolute; z-index: 2; top: 0.75rem; padding: 0.35rem 0.55rem; border-radius: 8px; font-size: 0.72rem; font-weight: 800; box-shadow: 0 5px 18px rgba(0, 0, 0, 0.3); }
.discount-badge { right: 0.75rem; background: linear-gradient(135deg, var(--cyan), #50a8ff); color: #071016; }
.choice-badge { left: 0.75rem; background: #161b25; color: #ffbd56; }
.card-body { display: flex; padding: 1rem; flex: 1; flex-direction: column; gap: 0.65rem; }
.card-kicker { display: flex; min-height: 20px; align-items: center; justify-content: space-between; gap: 0.5rem; color: var(--muted); font-size: 0.72rem; }
.artist-name { overflow: hidden; color: var(--cyan); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.release-year { flex: 0 0 auto; }
.record-title { display: -webkit-box; min-height: 2.7em; margin: 0; overflow: hidden; color: var(--text); font-size: 1rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.rating-row { display: flex; min-height: 22px; align-items: center; gap: 0.4rem; color: #ffcd70; font-size: 0.78rem; }
.rating-row .review-count { color: var(--muted); }
.tag-row { display: flex; min-height: 26px; overflow: hidden; flex-wrap: wrap; gap: 0.35rem; }
.deal-tag { max-width: 100%; padding: 0.25rem 0.45rem; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: rgba(255, 255, 255, 0.035); color: #c5cad7; font-size: 0.66rem; text-overflow: ellipsis; white-space: nowrap; }
.price-row { display: flex; margin-top: auto; align-items: baseline; gap: 0.55rem; }
.price-current { color: var(--green); font-size: 1.35rem; font-weight: 800; }
.price-list { color: var(--muted); font-size: 0.83rem; text-decoration: line-through; }
.savings { color: var(--muted); font-size: 0.72rem; }
.card-actions { display: flex; margin-top: 0.2rem; align-items: center; gap: 0.55rem; }
.btn-buy { flex: 1; background: rgba(255, 255, 255, 0.055); border-color: var(--border); }
.btn-buy:hover { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.prime-mark { color: #74b9ff; font-size: 0.7rem; font-weight: 750; }
.skeleton-card { min-height: 430px; border-radius: var(--radius); background: linear-gradient(100deg, rgba(255,255,255,0.025) 25%, rgba(255,255,255,0.075) 42%, rgba(255,255,255,0.025) 60%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -100% 0; } }
.no-results { grid-column: 1 / -1; padding: 5rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; color: var(--muted); }
.no-results svg { width: 52px; color: var(--subtle); }
.no-results h2 { margin: 0.8rem 0 0.25rem; color: var(--text); }
.no-results p { margin: 0; }
.error-state { color: var(--danger); }
.pagination { display: flex; margin-top: 2rem; align-items: center; justify-content: center; gap: 1rem; }
.pagination span { min-width: 110px; color: var(--muted); font-size: 0.85rem; text-align: center; }
.app-footer { padding: 2.5rem 1.5rem; border-top: 1px solid var(--border); color: var(--subtle); font-size: 0.76rem; text-align: center; }

@media (max-width: 1050px) {
  .search-toolbar { grid-template-columns: minmax(240px, 1fr) auto minmax(170px, 210px) 90px; }
  .catalog-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 1.25rem; }
  .records-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 820px) {
  body.filters-open { overflow: hidden; }
  .header-container { min-height: 78px; padding: 0.8rem 1rem; }
  .subtitle, .status-time { display: none; }
  .status-panel { grid-template-columns: auto auto; }
  .status-meta { display: none; }
  .progress-bar-container { display: none; }
  .main-content { padding: 1rem 1rem 3rem; }
  .search-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .search-box { grid-column: 1 / -1; }
  .filter-toggle { display: inline-flex; }
  .toolbar-select { min-width: 0; }
  .page-size-control { display: none; }
  .catalog-layout { display: block; }
  .filter-panel {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 60;
    width: min(92vw, 390px);
    max-height: 100vh;
    border-radius: 0;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.6);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0s linear 0.22s;
  }
  body.filters-open .filter-panel { transform: translateX(0); visibility: visible; transition-delay: 0s; }
  .filter-panel-header { position: sticky; top: 0; z-index: 2; background: #12141c; }
  .filter-panel-header .icon-button { display: block; }
  .filter-backdrop { position: fixed; inset: 0; z-index: 50; width: 100%; border: 0; background: rgba(0, 0, 0, 0.62); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  body.filters-open .filter-backdrop { display: block; opacity: 1; pointer-events: auto; }
  .mobile-filter-actions { position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; padding: 1rem; border-top: 1px solid var(--border); background: #12141c; }
  .results-heading-row { align-items: flex-start; }
}

@media (max-width: 560px) {
  .brand-title { font-size: 1.25rem; }
  .vinyl-spinner-container { width: 40px; height: 40px; flex-basis: 40px; }
  .status-panel .btn { padding-inline: 0.75rem; font-size: 0.8rem; }
  .search-toolbar { padding: 0.75rem; }
  .toolbar-select label { display: none; }
  .toolbar-select select { min-height: 42px; height: 42px; border: 1px solid var(--border); background-color: rgba(255,255,255,0.04); }
  .active-filter-row { align-items: center; }
  .metadata-note { display: none; }
  .records-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .card-body { padding: 0.75rem; }
  .record-title { font-size: 0.88rem; }
  .price-current { font-size: 1.1rem; }
  .btn-buy { padding-inline: 0.55rem; font-size: 0.76rem; }
  .choice-badge { display: none; }
  .discount-badge { top: 0.5rem; right: 0.5rem; }
  .skeleton-card { min-height: 330px; }
  .pagination { gap: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
