/* uMASK shared styles */

:root {
  --bg: #0a0a0c;
  --panel: #14141a;
  --panel-2: #1a1a22;
  --border: #2a2a35;
  --text: #ddd;
  --dim: #888;
  --common: #a0a0a8;
  --cursed: #c92020;
  --wraith: #b050d8;
  --nightmare: #ff7000;
  --mythic: #ffd040;
  --accent: #ffd040;
}

* { box-sizing: border-box; }

body {
  background: var(--bg); color: var(--text);
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  padding: 0; margin: 0; line-height: 1.55;
  min-height: 100vh;
}

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

/* ── Topbar ──────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  background: linear-gradient(to bottom, #15151a, #0a0a0c);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 250;  /* above modal so nav is always reachable */
}
.topbar .brand {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.04em;
  color: var(--text);
}
.topbar .brand .v { color: var(--mythic); }
.topbar .topnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar .topnav a {
  color: var(--dim);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.topbar .topnav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.topbar .topnav a.active { color: var(--mythic); background: var(--panel); }
.wallet-btn {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit; font-size: 12px;
  font-weight: bold;
}
.wallet-btn:hover { border-color: var(--mythic); color: var(--mythic); }
.wallet-btn.connected { color: var(--mythic); border-color: var(--mythic); }

.wallet-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--mythic);
  border-radius: 6px;
  min-width: 220px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.7);
  overflow: hidden;
  z-index: 300;
}
.wallet-menu-header {
  padding: 12px 14px;
  background: linear-gradient(180deg, #2a1a08, #14141a);
  border-bottom: 1px solid var(--border);
}
.wallet-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.wallet-menu-item:hover { background: var(--panel-2); color: var(--mythic); text-decoration: none; }
.wallet-menu-disconnect {
  border-top: 1px solid var(--border);
  color: var(--cursed);
}
.wallet-menu-disconnect:hover { background: rgba(201, 32, 32, 0.1); color: #ff6060; }

/* ── Hero / sections ─────────────────────────────── */
main { padding: 24px; max-width: 1280px; margin: 0 auto; }

.hero {
  padding: 60px 0 40px;
  text-align: center;
}
.hero h1 {
  font-size: 56px; margin: 0 0 12px;
  letter-spacing: -0.02em; line-height: 1.05;
}
.hero h1 .v { color: var(--mythic); }
.hero .pitch {
  color: var(--dim);
  font-size: 16px;
  max-width: 640px;
  margin: 0 auto 32px;
}
.hero .ctas {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-primary {
  background: var(--mythic);
  color: #1a0808;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(255,208,64,0.3); text-decoration: none; }
.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--mythic); color: var(--mythic); text-decoration: none; }
.btn-danger {
  background: var(--cursed);
  color: white;
}
.btn-disabled { opacity: 0.4; pointer-events: none; }

h2.section { font-size: 22px; margin: 40px 0 12px; }
h2.section .meta { color: var(--dim); font-weight: normal; font-size: 13px; margin-left: 8px; }

/* ── Stat cards ──────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 18px 0;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}
.stat-card .label { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-card .value { font-size: 22px; font-weight: bold; margin-top: 2px; }
.stat-card.common    .value { color: var(--common); }
.stat-card.cursed    .value { color: var(--cursed); }
.stat-card.wraith    .value { color: var(--wraith); }
.stat-card.nightmare .value { color: var(--nightmare); }
.stat-card.mythic    .value { color: var(--mythic); }

/* ── NFT grid ────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.cell {
  background: #000;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s, box-shadow 0.1s;
}
.cell:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.6); }
.cell img { display: block; width: 100%; aspect-ratio: 1; background: #000; }
.cell .tag {
  position: absolute; bottom: 2px; left: 2px; right: 2px;
  font-size: 9px; padding: 2px 6px;
  background: rgba(0,0,0,0.6); border-radius: 2px;
  display: flex; justify-content: space-between;
}
.cell .tag .id { color: #ccc; }
.cell .tag .price { color: var(--mythic); font-weight: bold; }
.cell .tag .listed { color: var(--mythic); }
.cell.tier-common    { border-color: var(--border); }
.cell.tier-cursed    { border-color: var(--cursed); }
.cell.tier-wraith    { border-color: var(--wraith); box-shadow: inset 0 0 0 1px rgba(176,80,216,0.25); }
.cell.tier-nightmare { border: 2px solid var(--nightmare); box-shadow: 0 0 0 1px rgba(0,0,0,0.6) inset, 0 0 8px rgba(255,112,0,0.4); }
.cell.tier-mythic    { border: 2px solid var(--mythic); box-shadow: 0 0 0 1px rgba(0,0,0,0.6) inset, 0 0 14px rgba(255,208,64,0.65); }
.cell.tier-mythic .tag .id { color: var(--mythic); }

/* ── Modal (OpenSea-style) ──────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.88);
  display: none; align-items: flex-start; justify-content: center;
  padding: 20px; z-index: 200; overflow-y: auto;
}
.modal.show { display: flex; }
.modal-content {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 0; max-width: 920px; width: 100%;
  display: grid; grid-template-columns: minmax(320px, 420px) 1fr;
  position: relative;
  margin: auto;
  overflow: hidden;
}
.modal-img-col {
  background: #000;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  border-right: 1px solid var(--border);
}
.modal-img-col img {
  width: 100%; max-width: 380px;
  border-radius: 8px; background: #000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.modal-info-col {
  padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
  max-height: 90vh; overflow-y: auto;
}
.modal-tier-chip {
  display: inline-block; padding: 3px 10px;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  border-radius: 3px; border: 1px solid currentColor;
  font-weight: bold;
  align-self: flex-start;
}
.modal-title-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.modal-title-row h2 { margin: 0; font-size: 24px; color: var(--text); }
.modal-title-row .rank { color: var(--mythic); font-size: 12px; }
.modal-name { font-size: 14px; color: var(--mythic); margin-top: -8px; font-style: italic; }

.owner-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.owner-row .label { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin-right: auto; }
.owner-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--mythic), var(--cursed));
  flex-shrink: 0;
}
.owner-link { color: var(--text); display: flex; align-items: center; gap: 6px; }
.owner-link:hover { color: var(--mythic); }
.owner-link .ext-icon { font-size: 11px; opacity: 0.7; }

.price-card {
  padding: 16px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 8px;
}
.price-card .price-label { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.price-card .price-value { font-size: 30px; font-weight: bold; color: var(--mythic); line-height: 1; }
.price-card .price-usd { color: var(--dim); font-size: 13px; margin-top: 4px; }
.price-card.unlisted .price-value { color: var(--dim); font-size: 18px; font-weight: normal; }

.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-width: 140px; }

.modal-section h3 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.props-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}
.prop-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  transition: border-color 0.1s;
}
.prop-card:hover { border-color: var(--mythic); }
.prop-card .pt { color: var(--mythic); font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; }
.prop-card .pv { color: var(--text); font-size: 12px; font-weight: bold; margin-top: 2px; word-break: break-word; }
.prop-card .pp { color: var(--dim); font-size: 10px; margin-top: 2px; }

.activity-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.activity-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 10px;
  padding: 8px 12px;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}
.activity-row:last-child { border-bottom: none; }
.activity-row .event {
  font-weight: bold;
  color: var(--text);
}
.activity-row .event.sale { color: var(--mythic); }
.activity-row .event.list { color: var(--wraith); }
.activity-row .event.transfer { color: #888; }
.activity-row .event.mint { color: #80ffd0; }
.activity-row .who { color: var(--dim); display: flex; gap: 4px; align-items: center; min-width: 0; }
.activity-row .who a { color: var(--text); }
.activity-row .when { color: var(--dim); font-size: 10px; text-align: right; white-space: nowrap; }
.activity-row .price { font-weight: bold; color: var(--mythic); }

.close { position: absolute; top: 12px; right: 16px; color: var(--dim); cursor: pointer; font-size: 24px; line-height: 1; background: transparent; border: none; z-index: 5; }
.close:hover { color: var(--text); }

@media (max-width: 720px) {
  .modal-content { grid-template-columns: 1fr; }
  .modal-img-col { border-right: none; border-bottom: 1px solid var(--border); padding: 16px; }
  .hero h1 { font-size: 36px; }
}

/* ── Forms in modals ─────────────────────────────── */
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-row label { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
.form-row input, .form-row select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  padding: 8px 10px; border-radius: 4px; font-family: inherit; font-size: 13px;
}
.form-row .hint { font-size: 11px; color: var(--dim); margin-top: 2px; }

/* ── Toast ─────────────────────────────────────── */
.toast-host {
  position: fixed; right: 24px; bottom: 24px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--mythic); border-left: 4px solid var(--mythic);
  padding: 12px 16px; border-radius: 4px;
  font-size: 13px; max-width: 360px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  animation: slideIn 0.2s ease-out;
}
.toast.error { border-color: var(--cursed); border-left-color: var(--cursed); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Empty state ─────────────────────────────────── */
.empty {
  text-align: center; padding: 80px 20px;
  color: var(--dim);
}
.empty h3 { margin: 0 0 8px; color: var(--text); }

/* ── Footer ──────────────────────────────────────── */
footer {
  margin-top: 80px;
  padding: 24px;
  border-top: 1px solid var(--border);
  color: var(--dim);
  font-size: 12px;
  text-align: center;
}
