:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --text: #191b22;
  --muted: #6f7481;
  --line: #e4e6ed;
  --brand: #6d4aff;
  --brand-2: #cf42f4;
  --brand-soft: #f1edff;
  --success: #18a56a;
  --warning: #db8c13;
  --danger: #d94c63;
  --shadow: 0 22px 60px rgba(32, 29, 52, 0.15);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.tiny {
  font-size: 12px;
}

.nowrap {
  white-space: nowrap;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 21px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(109, 74, 255, 0.28);
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-switcher {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #eceef4;
  border-radius: 13px;
}

.view-switcher a {
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  text-decoration: none;
}

.view-switcher a:hover {
  color: var(--text);
}

.view-switcher a.active {
  background: #fff;
  box-shadow: 0 3px 12px rgba(22, 24, 34, 0.08);
  color: var(--text);
}

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 650;
  transition: 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: #cfd2dc;
}

.btn.primary {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #8a5cff);
  box-shadow: 0 9px 22px rgba(109, 74, 255, 0.25);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: var(--danger);
}

.btn.small-btn {
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 10px;
}

.market-layout {
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 24px 150px;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  padding: 44px;
  border-radius: 28px;
  color: #fff;
  background:
    radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.22), transparent 27%),
    radial-gradient(circle at 72% 85%, rgba(255, 255, 255, 0.12), transparent 34%),
    linear-gradient(135deg, #221a55 0%, #5532c8 52%, #a846db 100%);
  box-shadow: 0 26px 70px rgba(56, 36, 125, 0.22);
}

.hero h1 {
  margin: 0 0 14px;
  max-width: 720px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.hero p {
  max-width: 660px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
  line-height: 1.6;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-badge {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 13px;
  backdrop-filter: blur(10px);
}

.hero-orb {
  position: absolute;
  right: 46px;
  bottom: 28px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 0 70px rgba(255, 255, 255, 0.13);
  display: grid;
  place-items: center;
}

.hero-orb::before,
.hero-orb::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.hero-orb::before {
  inset: 24px;
}

.hero-orb::after {
  inset: 52px;
}

.hero-orb span {
  font-size: 46px;
  filter: drop-shadow(0 9px 16px rgba(0, 0, 0, 0.2));
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 34px 0 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.category-tabs {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.category-tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  color: var(--muted);
}

.category-tab.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.market-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  height: fit-content;
  position: sticky;
  top: 90px;
}

.sidebar h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

.filter-group {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.filter-group:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.filter-label {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 9px 0;
  color: #4f5460;
  font-size: 14px;
}

.check input {
  accent-color: var(--brand);
}

.products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 17px;
  min-height: 224px;
  display: flex;
  flex-direction: column;
  transition: 0.18s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 34px rgba(30, 28, 48, 0.08);
  border-color: #d5d1e8;
}

.product-icon {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--brand-soft);
  font-size: 22px;
  margin-bottom: 14px;
}

.product-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.35;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.pill {
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f0f1f5;
  color: #5f6470;
}

.price-row {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price {
  font-size: 19px;
  font-weight: 850;
}

.stock {
  color: var(--success);
  font-size: 12px;
  font-weight: 750;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 100px;
  z-index: 110;
  background: #1d1f29;
  color: #fff;
  padding: 12px 15px;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 22, 30, 0.55);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal h2 {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 16px;
}

@media (max-width: 1050px) {
  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-orb {
    opacity: 0.25;
  }
}

@media (max-width: 820px) {
  .topbar {
    padding: 0 14px;
  }

  .header-actions .btn:not(.primary) {
    display: none;
  }

  .market-layout {
    padding: 18px 14px 140px;
  }

  .hero {
    padding: 28px 24px;
    min-height: 230px;
  }

  .market-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }
}

@media (max-width: 580px) {
  .topbar {
    gap: 8px;
  }

  .brand span:last-child {
    display: none;
  }

  .header-actions .btn.primary {
    padding: 9px 10px;
    font-size: 12px;
  }

  .view-switcher a {
    font-size: 12px;
    padding: 8px 9px;
  }

  .hero h1 {
    font-size: 36px;
  }

  .hero p {
    font-size: 15px;
  }

  .products {
    grid-template-columns: 1fr;
  }
}
