/* KLV NFT Market — dark, responsive, mobile-first. No horizontal overflow at 380px. */
:root {
  --bg: #0c0e14;
  --panel: #151824;
  --panel-2: #1c2030;
  --line: #2a2f42;
  --text: #e8eaf2;
  --muted: #9aa2b8;
  --accent: #7b6cff;
  --accent-2: #38e0c4;
  --good: #2fbf71;
  --warn: #f0a92b;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #1a1f33 0%, var(--bg) 60%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }

/* ── Topbar ── */
.nm-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: rgba(12, 14, 20, 0.7); backdrop-filter: blur(8px);
}
.nm-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nm-logo { color: var(--accent-2); font-size: 20px; }
.nm-brand-name { font-weight: 700; letter-spacing: 0.2px; }
.nm-badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; font-weight: 600; }
.nm-badge--demo { background: rgba(240, 169, 43, 0.15); color: var(--warn); border: 1px solid rgba(240,169,43,0.4); }
.nm-badge--live { background: rgba(47, 191, 113, 0.15); color: var(--good); border: 1px solid rgba(47,191,113,0.4); }
.nm-wallet { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.nm-wallet-status { font-size: 13px; color: var(--muted); max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Buttons ── */
.nm-btn {
  background: linear-gradient(135deg, var(--accent), #5b4bff);
  color: #fff; border: 0; border-radius: 10px; padding: 10px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.nm-btn:hover { filter: brightness(1.08); }
.nm-btn--ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.nm-btn--sm { padding: 6px 12px; font-size: 13px; }

/* ── Hero ── */
.nm-hero { padding: 28px 16px 8px; text-align: center; }
.nm-hero h1 { font-size: clamp(22px, 6vw, 38px); margin: 0 0 8px; }
.nm-sub { color: var(--muted); max-width: 640px; margin: 0 auto; font-size: 15px; }

/* ── Tabs ── */
.nm-tabs { display: flex; gap: 6px; justify-content: center; padding: 16px 12px 0; flex-wrap: wrap; }
.nm-tab {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  padding: 9px 18px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.nm-tab.is-active { color: #fff; border-color: var(--accent); background: var(--panel-2); }

/* ── Layout ── */
.nm-main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 40px; }
.nm-panel-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.nm-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.nm-controls label { color: var(--muted); font-size: 14px; }
.nm-select, .nm-input {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font-size: 14px; max-width: 100%; width: 100%;
}
.nm-select { width: auto; min-width: 220px; max-width: 100%; }

/* ── Collection stats ── */
.nm-col-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.nm-col-name { font-size: 18px; font-weight: 700; }
.nm-verified { color: var(--good); font-size: 12px; }
.nm-mock { color: var(--warn); font-size: 12px; border: 1px solid rgba(240,169,43,0.4); border-radius: 999px; padding: 1px 8px; }
.nm-stats { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.nm-stats dt { color: var(--muted); }
.nm-stats dd { margin: 0; word-break: break-word; }

/* ── Item grid ── */
.nm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.nm-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.nm-card-media { aspect-ratio: 1 / 1; background: var(--panel-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.nm-card-media img { width: 100%; height: 100%; object-fit: cover; }
.nm-card-media--broken { color: var(--muted); font-size: 34px; }
.nm-card-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nm-card-title { font-size: 14px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nm-card-id { font-size: 11px; color: var(--accent-2); font-family: monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm-card-owner { font-size: 11px; color: var(--muted); font-family: monospace; }
.nm-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.nm-price { color: var(--accent-2); font-weight: 700; font-size: 14px; }
.nm-unlisted { color: var(--muted); font-size: 12px; }

/* ── Marketplace ── */
.nm-market-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.nm-h2 { font-size: 16px; margin: 0 0 8px; }
.nm-note, .nm-msg { font-size: 13px; color: var(--muted); }
.nm-form { display: flex; flex-direction: column; gap: 12px; }
.nm-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.nm-fee { background: var(--panel-2); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.nm-fee-line { color: var(--text); }
.nm-listings { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.nm-listing { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.nm-listing-id { font-family: monospace; font-size: 12px; color: var(--accent-2); }
.nm-listing-seller { font-family: monospace; font-size: 11px; color: var(--muted); }
.nm-listing .nm-price { margin-left: auto; }
.nm-receipt { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 13px; }
.nm-receipt-head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.nm-receipt-reason { color: var(--warn); font-size: 12px; }
.nm-empty { color: var(--muted); font-size: 14px; }

.nm-footer { border-top: 1px solid var(--line); padding: 16px; text-align: center; color: var(--muted); font-size: 12px; }

/* ── Responsive ── */
@media (max-width: 720px) {
  .nm-market-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .nm-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .nm-wallet-status { max-width: 50vw; }
  .nm-select { min-width: 0; width: 100%; }
}
