:root {
  --bg: #0b0d10;
  --bg-elev: #14181d;
  --bg-elev-2: #1b2129;
  --border: #262d36;
  --text: #e7ecf2;
  --muted: #8b97a6;
  --accent: #10b981;
  --accent-2: #34d399;
  --danger: #f43f5e;
  --warn: #f59e0b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 600px at 50% -200px, #12303022, transparent),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(11, 13, 16, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 6px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04120c;
  font-weight: 900;
}
.brand-text { color: var(--text); }

.search { flex: 1; max-width: 620px; }
.search input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  outline: none;
}
.search input:focus { border-color: var(--accent); }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s;
}
.btn:hover { text-decoration: none; border-color: #33404d; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04120c;
  border: none;
}
.btn.ghost { background: transparent; }
.btn.danger { color: #fff; background: var(--danger); border: none; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Layout ---------- */
.app {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 20px 60px;
  flex: 1;
}
.loading, .empty {
  text-align: center;
  color: var(--muted);
  padding: 80px 20px;
}

/* ---------- Filters ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  text-transform: capitalize;
  white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.active {
  color: #04120c;
  background: var(--accent-2);
  border-color: var(--accent-2);
  font-weight: 700;
}
.select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.08s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-3px); border-color: #33404d; }
.card-img {
  aspect-ratio: 4 / 3;
  background: var(--bg-elev-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .placeholder { font-size: 40px; opacity: 0.4; }
.card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: capitalize;
}
.card-body { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-price { font-weight: 800; color: var(--accent-2); font-size: 16px; }
.card-title {
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta { margin-top: auto; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 6px; }

/* ---------- Pagination ---------- */
.pager { display: flex; justify-content: center; gap: 8px; margin-top: 26px; align-items: center; }
.pager .muted { color: var(--muted); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: grid;
  place-items: start center;
  padding: 30px 16px;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 720px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop 0.14s ease;
}
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.modal-body { padding: 18px; }

/* ---------- Detail ---------- */
.gallery { display: grid; gap: 10px; margin-bottom: 16px; }
.gallery-main {
  aspect-ratio: 16 / 10;
  background: var(--bg-elev-2);
  border-radius: 10px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-main .placeholder { font-size: 64px; opacity: 0.3; }
.gallery-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery-thumbs img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: 8px; cursor: pointer; border: 2px solid transparent;
}
.gallery-thumbs img.active { border-color: var(--accent); }

.detail-price { font-size: 26px; font-weight: 800; color: var(--accent-2); }
.detail-title { font-size: 22px; margin: 4px 0 10px; }
.detail-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tag {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--bg-elev-2); color: var(--muted); text-transform: capitalize;
}
.detail-desc { white-space: pre-wrap; word-break: break-word; color: #cdd6e0; margin: 12px 0; }
.detail-contact {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
  word-break: break-word;
}
.detail-contact h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text);
  outline: none;
  font: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { min-height: 130px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}
.dropzone:hover { border-color: var(--accent); color: var(--text); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs .up {
  position: relative;
  width: 72px; height: 72px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
}
.thumbs .up img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .up button {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.7); color: #fff; cursor: pointer; line-height: 1;
}
.thumbs .up.loading { display: grid; place-items: center; font-size: 11px; }

/* ---------- Token box ---------- */
.token-box {
  background: #1a2b22;
  border: 1px solid #245c43;
  border-radius: 10px;
  padding: 14px;
  margin-top: 6px;
}
.token-box code {
  display: block;
  background: #04120c;
  padding: 10px 12px;
  border-radius: 8px;
  margin: 8px 0;
  font-size: 13px;
  word-break: break-all;
  color: var(--accent-2);
}
.warn { color: var(--warn); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 100;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 22px 20px 40px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.footer .fine { font-size: 12px; opacity: 0.8; max-width: 640px; margin: 6px auto 0; }

.mine-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
  background: var(--bg-elev-2);
}
.mine-item .mi-title { flex: 1; font-weight: 600; }

@media (max-width: 620px) {
  .brand-text { display: none; }
  .actions .ghost { display: none; }
  .row, .row-3 { grid-template-columns: 1fr; }
}
