:root {
  --bg: #131314;
  --bg-elev: #1e1e1f;
  --bg-hover: #262629;
  --bg-card: rgba(229, 229, 234, 0.06);
  --bg-input: rgba(229, 229, 234, 0.06);

  --text: #e5e5ea;
  --text-dim: #7d7d85;
  --text-mute: #606066;
  --text-white: #ffffff;

  --border: rgba(229, 229, 234, 0.2);
  --border-dim: rgba(229, 229, 234, 0.1);
  --border-hover: rgba(229, 229, 234, 0.3);

  --accent: #3069ff;
  --accent-hover: #5585ff;
  --green: #4bb34b;
  --green-hover: #5cc55c;
  --red: #e54b4b;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 1000px;

  --shadow-xs: 0 2px 10px rgba(0,0,28,0.06), 0 0 1px rgba(0,0,28,0.08);
  --shadow-sm: 0 2px 28px rgba(0,0,28,0.06), 0 0 1px rgba(0,0,28,0.12);
  --shadow-md: 0 0 32px rgba(0,0,28,0.12), 0 0 2px rgba(0,0,28,0.08);
  --shadow-lg: 0 0 64px rgba(0,0,28,0.32), 0 0 2px rgba(0,0,28,0.08);

  --transition-fast: 0.1s;
  --transition: 0.2s;
  --transition-slow: 0.4s;
  --ease: ease-in-out;

  --navbar-height: 64px;
  --max-width: 1920px;
  --page-padding: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--page-padding); }

/* ===== HEADER ===== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(19, 19, 20, 0.85);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--border-dim);
}

.header-inner { display: flex; align-items: center; gap: 16px; height: var(--navbar-height); }

.logo {
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  letter-spacing: -0.3px;
}

.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent) 0%, #1f4dd6 100%);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.logo span { color: var(--accent); }

.search-wrap { flex: 1; max-width: 480px; position: relative; }
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); width: 16px; height: 16px; pointer-events: none;
}
.search-wrap input {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border-dim);
  border-radius: var(--radius-md); padding: 10px 16px 10px 42px;
  color: var(--text); font-size: 15px; outline: none;
  transition: border var(--transition);
}
.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--text-mute); }

.auth-box { margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border-dim);
  color: var(--text); transition: all var(--transition); white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border); }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-green {
  background: var(--green); border-color: var(--green); color: #fff;
}
.btn-green:hover { background: var(--green-hover); border-color: var(--green-hover); }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.user-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border-dim);
  border-radius: var(--radius-full); padding: 4px 14px 4px 4px;
  cursor: pointer; transition: all var(--transition);
}
.user-pill:hover { border-color: var(--accent); }
.user-pill img, .user-pill .avatar {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
}
.user-pill .avatar {
  background: linear-gradient(135deg, var(--accent), #1f4dd6);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
}
.user-pill .name { font-size: 14px; font-weight: 600; }

/* ===== STATS BAR ===== */
.stats-bar { border-bottom: 1px solid var(--border-dim); }
.stats-inner {
  display: flex; align-items: center; gap: 32px;
  padding: 12px 0; font-size: 13px; overflow-x: auto;
}
.stats-inner::-webkit-scrollbar { display: none; }

.stat { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.stat .label { color: var(--text-dim); }
.stat .value { font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .value.green { color: var(--green); }
.stat .value.accent { color: var(--accent); }

/* ===== FILTERS ===== */
.filters { padding: 20px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.filter-input, .filter-select {
  background: var(--bg-card); border: 1px solid var(--border-dim);
  border-radius: var(--radius-md); padding: 10px 14px;
  color: var(--text); font-size: 14px; outline: none;
  transition: all var(--transition);
}
.filter-input:focus, .filter-select:focus { border-color: var(--accent); }
.filter-input { width: 120px; }
.filter-input::placeholder { color: var(--text-mute); }

.filter-select {
  cursor: pointer; padding-right: 36px; appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d7d85' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 14px center;
}

.chip {
  background: var(--bg-card); border: 1px solid var(--border-dim);
  border-radius: var(--radius-full); padding: 8px 16px;
  font-size: 13px; font-weight: 500; color: var(--text-dim);
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.chip:hover { border-color: var(--border); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ===== GRID ===== */
.gift-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 20px 0 80px;
}

/* ===== CARD ===== */
.gift-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-slow) var(--ease);
  display: flex; flex-direction: column;
  position: relative;
}
.gift-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-image-wrap {
  position: relative;
  aspect-ratio: 1;
  background: radial-gradient(circle at 50% 0%, #222226 0%, #16161a 100%);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}

.card-image {
  width: 100%; height: 100%; object-fit: contain;
  border-radius: var(--radius-md);
  transition: transform var(--transition-slow) var(--ease);
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.4));
}
.gift-card:hover .card-image { transform: scale(1.05); }

.card-image-placeholder { font-size: 48px; opacity: 0.15; color: var(--text-dim); }

.attr-badges {
  position: absolute; bottom: 10px; left: 10px; right: 10px;
  display: flex; flex-wrap: wrap; gap: 4px; pointer-events: none;
}
.attr-badge {
  background: rgba(19,19,20,0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-sm); padding: 3px 8px;
  font-size: 10px; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--border-dim);
}
.attr-badge .rarity { color: var(--green); font-size: 9px; font-weight: 700; }

.card-body {
  padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 10px; flex: 1;
}
.card-name {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-price-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.card-price {
  font-size: 17px; font-weight: 700;
  color: var(--green); font-variant-numeric: tabular-nums;
  letter-spacing: -0.4px; line-height: 1.1;
}
.card-price-usd { font-size: 11px; color: var(--text-dim); font-weight: 500; margin-top: 2px; }
.card-listings { font-size: 11px; color: var(--text-dim); font-weight: 500; white-space: nowrap; }

.card-actions { display: flex; gap: 6px; margin-top: 4px; }
.card-actions .btn { flex: 1; padding: 9px 12px; font-size: 13px; border-radius: var(--radius-sm); }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 200; padding: 24px; overflow-y: auto;
}
.modal-overlay.active { display: flex; align-items: flex-start; justify-content: center; }

.modal-content {
  background: var(--bg-elev);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-2xl);
  max-width: 960px; width: 100%; margin: 40px 0;
  overflow: hidden; box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-dim);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.modal-title { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.modal-subtitle { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

.modal-close {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-card); border: 1px solid var(--border-dim);
  color: var(--text-dim); font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border); }

.modal-body { padding: 28px; }

.modal-preview { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 28px; }
.modal-preview-img {
  width: 140px; height: 140px;
  background: radial-gradient(circle at 50% 0%, #222226 0%, #16161a 100%);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden; padding: 12px;
  border: 1px solid var(--border-dim);
}
.modal-preview-img img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius-md); }

.modal-price-block { flex: 1; }
.modal-price {
  font-size: 36px; font-weight: 700; color: var(--green);
  letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums;
}
.modal-price-usd { font-size: 14px; color: var(--text-dim); margin-top: 6px; font-weight: 500; }
.modal-price-meta { font-size: 13px; color: var(--text-dim); margin-top: 12px; }

.attr-section { margin-bottom: 24px; }
.attr-section h3 {
  font-size: 12px; font-weight: 700; color: var(--text-dim);
  margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px;
}
.attr-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.attr-pill {
  background: var(--bg-card); border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm); padding: 7px 12px;
  font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all var(--transition);
}
.attr-pill:hover { border-color: var(--border); background: var(--bg-hover); }
.attr-pill .rarity { color: var(--green); font-weight: 700; font-size: 11px; }

.listings-container {
  border: 1px solid var(--border-dim); border-radius: var(--radius-md);
  overflow: hidden; background: var(--bg);
}
.listing-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-dim);
  transition: background var(--transition);
}
.listing-row:last-child { border-bottom: none; }
.listing-row:hover { background: var(--bg-hover); }
.listing-id {
  font-size: 12px; color: var(--text-dim);
  font-family: "SF Mono", Monaco, monospace;
  width: 160px; flex-shrink: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.listing-attrs { flex: 1; display: flex; gap: 4px; flex-wrap: wrap; min-width: 0; }
.listing-attr {
  font-size: 11px; color: var(--text-dim);
  background: var(--bg-card); border: 1px solid var(--border-dim);
  border-radius: var(--radius-xs); padding: 2px 6px;
  white-space: nowrap;
}
.listing-price {
  font-size: 14px; font-weight: 700; color: var(--green);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.listing-buy { flex-shrink: 0; padding: 6px 14px; font-size: 12px; border-radius: var(--radius-sm); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  background: var(--bg-elev); border: 1px solid var(--border-dim);
  border-radius: var(--radius-md); padding: 14px 20px;
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 12px;
  min-width: 280px; pointer-events: auto;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

/* ===== SKELETON ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== EMPTY ===== */
.empty-state { text-align: center; padding: 100px 20px; color: var(--text-dim); }
.empty-state .icon { font-size: 64px; margin-bottom: 20px; opacity: 0.3; }
.empty-state .title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .gift-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px 0 60px; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px 0; gap: 12px; }
  .search-wrap { order: 3; width: 100%; max-width: none; flex-basis: 100%; }
  .card-image-wrap { padding: 10px; }
  .card-body { padding: 10px 12px 12px; gap: 8px; }
  .card-price { font-size: 15px; }
  .card-actions .btn { padding: 7px 8px; font-size: 12px; }
  .filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 8px; }
  .filters::-webkit-scrollbar { display: none; }
  .modal-content { margin: 0; border-radius: var(--radius-lg); }
  .modal-body { padding: 20px; }
  .modal-preview { flex-direction: column; }
  .modal-preview-img { width: 100%; max-width: 200px; aspect-ratio: 1; height: auto; }
  .modal-price { font-size: 28px; }
  .listing-id { width: 100px; font-size: 11px; }
  .listing-attrs { display: none; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: auto; }
}
/* Getgems-inspired marketplace refresh */
:root{--bg:#050b14;--bg-elev:#0c1523;--bg-hover:#13243a;--bg-card:#0d1726;--bg-input:#0b1727;--text:#edf5ff;--text-dim:#91a4bf;--text-mute:#647b98;--border:rgba(127,169,224,.22);--border-dim:rgba(127,169,224,.12);--border-hover:rgba(48,158,255,.55);--accent:#1598ff;--accent-hover:#40b2ff;--green:#31d5a0;--green-hover:#5ae4ba;--radius-md:14px;--radius-lg:18px;--shadow-md:0 16px 45px rgba(0,0,0,.28)}
html,body{background:radial-gradient(ellipse at 60% -20%,rgba(25,83,174,.22),transparent 45%),#050b14;color:var(--text)}
.header{background:rgba(5,11,20,.9);border-color:var(--border-dim)}
.logo-icon{background:linear-gradient(135deg,#36c4ff,#315bff);border-radius:10px;box-shadow:0 0 26px #168bff55}
.search-wrap,.filter-select,.filter-input{background:#0b1727;border:1px solid var(--border);border-radius:12px}
.stats-bar{background:rgba(8,17,30,.72);border-color:var(--border-dim)}
.stat .value.green{color:#38d9b0}.btn-primary{background:linear-gradient(120deg,#20a7ff,#1678f5);box-shadow:0 5px 18px #087fff33}.btn-green{background:#102d3a;color:#55e6c0;border:1px solid #1d685f}
.market-hero{position:relative;isolation:isolate;overflow:hidden;display:flex;align-items:center;justify-content:space-between;min-height:270px;margin-top:24px;margin-bottom:24px;padding:34px 42px;border:1px solid rgba(79,135,255,.28);border-radius:20px;background:radial-gradient(ellipse at 78% 50%,rgba(43,79,220,.58),transparent 38%),linear-gradient(110deg,#0a1830,#101747 65%,#1a2e77);box-shadow:0 22px 60px #0005}
.hero-copy{position:relative;z-index:2;max-width:520px}.hero-eyebrow{font-size:11px;font-weight:800;letter-spacing:1.5px;color:#56d5ff;margin-bottom:12px}.hero-copy h1{font-size:clamp(30px,3.4vw,48px);line-height:1.08;letter-spacing:-1.8px;margin:0 0 12px;font-weight:800}.hero-copy h1 span{color:#51bdff}.hero-copy p{max-width:420px;color:#c3d5ef;font-size:15px;margin-bottom:20px}.hero-cta{padding:13px 20px;border-radius:12px}.hero-cta span{margin-left:14px}.hero-art{position:relative;width:34%;min-width:190px;height:200px;display:grid;place-items:center}.hero-gift{z-index:1;font-size:clamp(95px,11vw,150px);filter:drop-shadow(0 15px 28px #0da8ff88);transform:rotate(-8deg);animation:giftfloat 5s ease-in-out infinite}.hero-glow{position:absolute;width:170px;height:170px;border-radius:50%;background:#277bff55;filter:blur(42px)}.hero-orbit{position:absolute;width:260px;height:110px;border:1px solid #5a9aff88;border-radius:50%;transform:rotate(-18deg)}@keyframes giftfloat{0%,100%{transform:translateY(0) rotate(-8deg)}50%{transform:translateY(-8px) rotate(-4deg)}}
.filters{gap:10px;padding:14px;background:#091321;border:1px solid var(--border-dim);border-radius:16px;margin-bottom:18px}.gift-grid{gap:16px}.gift-card{overflow:hidden;background:linear-gradient(160deg,#101c2c,#0a1320);border:1px solid var(--border);border-radius:16px;transition:transform .18s,border-color .18s,box-shadow .18s}.gift-card:hover{transform:translateY(-3px);border-color:#238fff99;box-shadow:0 14px 34px #0005}.card-image-wrap{background:radial-gradient(ellipse at 50% 40%,#203d65,#0a1422 70%);padding:10px}.card-image{border-radius:10px;object-fit:contain}.card-body{padding:13px}.card-name{font-weight:650;letter-spacing:-.2px}.card-price{font-size:19px;font-weight:800;color:#f1f7ff}.card-price-usd{color:#8299b7}.card-listings{font-size:11px;color:#8ba3c2}.modal-content{background:#0b1421;border:1px solid var(--border);border-radius:18px;box-shadow:0 25px 90px #000b}.modal-header{border-color:var(--border-dim)}.modal-preview-img{border-radius:16px;background:radial-gradient(ellipse,#203d65,#091321)}.listing-row{border-color:var(--border-dim)}
@media(max-width:700px){.market-hero{padding:25px 22px;min-height:220px}.hero-art{min-width:90px;width:28%;height:140px}.hero-gift{font-size:75px}.hero-orbit{width:130px;height:70px}.hero-copy h1{font-size:29px}.hero-copy p{font-size:13px}.hero-eyebrow{font-size:9px}.gift-grid{gap:10px}.card-body{padding:10px}}
