:root {
  --text: #4a4a4a;
  --blue: #0041a2;
  --blue-dark: #001c71;
  --blue-light: #3660cd;
  --bg: #eff6ff;
  --white: #ffffff;
  --border: #c7d5e5;
  --muted: #6b7c93;
  --input-wash: #cfe2fb;
  --readonly: #e4ebf3;
  --ok: #28dfa8;
  --warn: #ff8311;
  --bad: #fc3c6a;
  --shadow: rgba(0, 23, 106, 0.1);
  --sans: "Manrope", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 10px;
  --max: 1040px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(54, 96, 205, 0.16), transparent 55%),
    radial-gradient(800px 380px at 100% 0%, rgba(67, 187, 195, 0.12), transparent 50%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 42%, #e8f1fb 100%);
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.9em; }

.wrap { width: min(var(--max), calc(100% - 2rem)); margin: 0 auto; }

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 2px 2px 20px var(--shadow);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex: 0 1 auto;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.brand:hover { text-decoration: none; color: inherit; }
.brand img {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1rem, 2.8vw, 1.15rem);
  color: var(--blue-dark);
  white-space: nowrap;
  line-height: 1.2;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: center;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}
.nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  padding: 0.25rem 0.15rem;
}
.nav a:hover, .nav a.active { color: var(--blue); }

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  flex: 0 1 auto;
  justify-content: flex-end;
  margin-left: auto;
}

.btn {
  appearance: none;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  font: 600 0.92rem/1.2 var(--sans);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost {
  background: var(--white);
  color: var(--blue);
}
.btn-ghost:hover { background: #f3f7fd; color: var(--blue-dark); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

.hero {
  margin: 2.25rem 0 1.5rem;
  animation: rise 0.55s ease both;
}
.hero h1 {
  margin: 0 0 0.6rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 2.75rem);
  color: var(--blue-dark);
  letter-spacing: -0.02em;
}
.hero p {
  margin: 0;
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.05rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.25rem; }

.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  box-shadow: 2px 2px 18px var(--shadow);
  margin-bottom: 1.25rem;
  animation: rise 0.6s ease 0.05s both;
}
.panel h2 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 1.35rem;
  color: var(--blue-dark);
}
.panel .lead { margin: 0 0 1rem; color: var(--muted); font-size: 0.95rem; }

.grid { display: grid; gap: 1rem; }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--blue-dark); }
.field input, .field select, .field textarea {
  border: 1px solid var(--border);
  background: #f7fbff;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font: 400 0.95rem/1.3 var(--sans);
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(0, 65, 162, 0.25);
  border-color: var(--blue-light);
}
.hint { font-size: 0.8rem; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin: 0.5rem 0 1rem; }
.checks label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.92rem; }

.listing {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--white);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 2px 2px 16px var(--shadow);
}
.listing:hover {
  border-color: var(--blue-light);
  transform: translateY(-3px);
  box-shadow: 4px 8px 24px rgba(0, 23, 106, 0.12);
}
.listing-cover {
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, #001c71 0%, #3660cd 55%, #67bbc3 100%);
  background-size: cover;
  background-position: center;
  position: relative;
}
.listing-cover::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  background: linear-gradient(transparent, rgba(0, 28, 113, 0.35));
  pointer-events: none;
}
.listing-body { padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: 0.45rem; flex: 1; }
.listing h3 { margin: 0; font-family: var(--display); font-size: 1.2rem; color: var(--blue-dark); }
.listing .about {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.6em;
}
.listing .meta { font-size: 0.78rem; color: var(--muted); word-break: break-all; }
.listing .row { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; font-size: 0.9rem; }
.listing .socials { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.25rem; }
.listing .socials a {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  text-decoration: none;
}
.listing .socials a:hover { background: #dce8ff; }
.listing .card-actions { margin-top: auto; padding-top: 0.75rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }

.socials-list { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 0.65rem; }
.social-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 0.5rem; align-items: center; }
@media (max-width: 560px) {
  .social-row { grid-template-columns: 1fr; }
}
.social-row select, .social-row input {
  border: 1px solid var(--border);
  background: #f7fbff;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font: 400 0.92rem/1.3 var(--sans);
}
.btn-icon {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--bad);
  border-radius: 8px;
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.cover-upload { display: flex; flex-direction: column; gap: 0.55rem; }
.cover-preview {
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #f3f7fd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.cover-preview.has-img span { display: none; }
.cover-upload input[type="file"] { font-size: 0.85rem; }

textarea {
  border: 1px solid var(--border);
  background: #f7fbff;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font: 400 0.95rem/1.4 var(--sans);
  color: var(--text);
  resize: vertical;
  min-height: 6rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 600;
}
.pill.warn { background: #fff4e8; color: #c45f00; }
.pill.ok { background: #e8fff6; color: #0a8a5c; }

.status {
  min-height: 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}
.status.err { color: var(--bad); }
.status.ok { color: #0a8a5c; }

.wallet-chip {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: #f3f7fd;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
}

.fees {
  display: grid;
  gap: 0.65rem;
}
.fee-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #f3f7fd;
  border: 1px solid var(--border);
}
.fee-item strong { color: var(--blue-dark); }

.footer {
  margin: 2.5rem 0 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.auth-gate {
  margin-top: 2rem;
  text-align: left;
  animation: rise 0.45s ease both;
}
.auth-gate h2 {
  margin: 0 0 0.4rem;
  font-family: var(--display);
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  color: var(--blue-dark);
}
.auth-gate .lead { max-width: 36rem; }
body[data-require-wallet="1"]:not(.wallet-ready) #authContent { display: none !important; }
body[data-require-wallet="1"].wallet-ready #authGate { display: none !important; }
body[data-require-wallet="1"].wallet-ready #authContent { display: block; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .nav { justify-content: flex-start; order: 3; flex: 1 1 100%; }
  .top-actions { order: 2; }
  .brand { order: 1; }
}

@media (max-width: 560px) {
  .top {
    padding: 0.7rem 0.85rem;
    gap: 0.65rem;
  }
  .brand img { width: 32px; height: 32px; }
  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .top-actions .wallet-chip { flex: 1 1 auto; text-align: center; }
  .nav {
    gap: 0.15rem 0.65rem;
    padding-top: 0.15rem;
    border-top: 1px solid var(--border);
  }
  .nav a { font-size: 0.85rem; }
  #btnWc { display: none; } /* WalletConnect still available via Connect on mobile auto-flow */
}
