:root {
  --bg: #0f1419;
  --surface: #182028;
  --surface-2: #202b36;
  --border: #2c3a47;
  --text: #eef3f8;
  --muted: #93a4b5;
  --accent: #38bdf8;
  --best-bg: rgba(34, 197, 94, 0.16);
  --best-text: #4ade80;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.container {
  width: min(1060px, 100% - 24px);
  margin: 0 auto;
}

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
}

h1 {
  margin: 0;
  font-size: 1.25rem;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.controls {
  margin: 16px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#searchInput {
  flex: 1 1 260px;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

#searchInput:focus,
#sortSelect:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

#sortSelect {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
}

.provider-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.provider-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.provider-chip.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--accent);
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.toast {
  color: var(--accent);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  padding-bottom: 32px;
}

.shop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.shop-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.shop-cats {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--muted);
}

.best-badge {
  background: var(--best-bg);
  color: var(--best-text);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

.offer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.offer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.88rem;
}

.offer-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.offer-provider {
  font-weight: 600;
}

.offer-note {
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.offer-rate {
  font-weight: 600;
}

.offer-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  padding: 3px 7px;
  border-radius: 6px;
}

.offer-link:hover {
  border-color: var(--accent);
}

.btn-secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding-bottom: 48px;
}

.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

.hidden {
  display: none !important;
}
