@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --background: hsl(220 20% 97%);
  --foreground: hsl(222 47% 11%);
  --card: hsl(0 0% 100%);
  --card-foreground: hsl(222 47% 11%);
  --primary: hsl(222 47% 11%);
  --primary-foreground: hsl(45 100% 96%);
  --secondary: hsl(220 16% 93%);
  --secondary-foreground: hsl(222 47% 11%);
  --muted: hsl(220 16% 93%);
  --muted-foreground: hsl(220 10% 46%);
  --accent: hsl(42 100% 50%);
  --accent-foreground: hsl(222 47% 11%);
  --destructive: hsl(0 72% 51%);
  --destructive-foreground: hsl(0 0% 100%);
  --border: hsl(220 13% 88%);
  --ring: hsl(42 100% 50%);
  --gold: hsl(42 100% 50%);
  --gold-light: hsl(45 100% 96%);
  --gold-dark: hsl(38 90% 40%);
  --navy: hsl(222 47% 11%);
  --navy-light: hsl(220 30% 20%);
  --success: hsl(152 60% 42%);
  --success-foreground: hsl(0 0% 100%);
  --warning: hsl(38 92% 50%);
  --warning-foreground: hsl(0 0% 100%);
  --radius: 0.75rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; flex-direction: column; }
.app main { flex: 1; }

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: hsla(0, 0%, 100%, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--foreground);
}
.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, hsl(42 100% 50%), hsl(38 90% 40%));
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-foreground);
}
.nav { display: none; gap: 0.25rem; }
.nav-link {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--foreground); }
.nav-link.active { color: var(--foreground); }
.header-actions { display: none; align-items: center; gap: 0.75rem; }
@media (min-width: 768px) {
  .nav, .header-actions { display: flex; }
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 3rem 0;
  margin-top: 4rem;
}
.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: repeat(4, 1fr); }
}
.footer-col h4 { font-size: 0.875rem; margin-bottom: 0.75rem; font-weight: 600; }
.footer-col p, .footer-col li { font-size: 0.875rem; color: var(--muted-foreground); line-height: 1.6; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-col a:hover { color: var(--foreground); }
.footer-bottom {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px hsl(222 47% 11% / 0.06), 0 4px 12px hsl(222 47% 11% / 0.04);
  overflow: hidden;
}
.card-body { padding: 1.5rem; }
.card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.card-title { font-size: 1.125rem; font-weight: 600; }
.card-hover { transition: transform 0.15s, box-shadow 0.15s; cursor: pointer; }
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px hsl(222 47% 11% / 0.08), 0 8px 24px hsl(222 47% 11% / 0.06);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, hsl(42 100% 50%), hsl(38 90% 40%));
  color: var(--accent-foreground);
  box-shadow: 0 4px 24px -4px hsl(42 100% 50% / 0.25);
}
.btn-primary:hover { opacity: 0.92; }

.btn-navy {
  background: var(--navy);
  color: var(--primary-foreground);
}
.btn-navy:hover { background: var(--navy-light); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}
.btn-outline:hover { background: var(--secondary); }

.btn-outline-light {
  background: transparent;
  border: 1px solid hsla(0, 0%, 100%, 0.4);
  color: var(--primary-foreground);
}
.btn-outline-light:hover { background: hsla(0, 0%, 100%, 0.1); }

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
}
.btn-ghost:hover { background: var(--secondary); color: var(--foreground); }

.btn-success {
  background: var(--success);
  color: var(--success-foreground);
}
.btn-success:hover { opacity: 0.9; }

.btn-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
}
.btn-destructive:hover { opacity: 0.9; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.25rem; }
.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--foreground);
}
.label-muted { color: var(--muted-foreground); font-size: 0.75rem; font-weight: 500; margin-bottom: 0.375rem; display: block; }
.input, .select, .textarea {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card);
  color: var(--foreground);
  font: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; padding: 0.5rem 0.75rem; resize: vertical; min-height: 5rem; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px hsl(42 100% 50% / 0.15);
}

.help-text { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.375rem; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.checkbox-row input[type="checkbox"] {
  width: 1rem; height: 1rem; margin-top: 0.2rem;
  accent-color: var(--accent);
}
.checkbox-row label {
  font-size: 0.875rem;
  line-height: 1.5;
  cursor: pointer;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
}
.badge-success { border-color: hsla(152, 60%, 42%, 0.3); background: hsla(152, 60%, 42%, 0.1); color: var(--success); }
.badge-warn    { border-color: hsla(38, 92%, 50%, 0.3); background: hsla(38, 92%, 50%, 0.1); color: var(--gold-dark); }
.badge-info    { border-color: hsla(222, 47%, 30%, 0.3); background: hsla(222, 47%, 30%, 0.08); color: var(--navy); }
.badge-muted   { background: var(--secondary); color: var(--muted-foreground); }
.badge-danger  { border-color: hsla(0, 72%, 51%, 0.3); background: hsla(0, 72%, 51%, 0.1); color: var(--destructive); }

/* ---------- Alerts ---------- */
.alert {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  font-size: 0.875rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.alert-info { border-color: hsla(222, 47%, 11%, 0.15); background: hsl(220 16% 95%); color: var(--foreground); }
.alert-success { border-color: hsla(152, 60%, 42%, 0.3); background: hsla(152, 60%, 42%, 0.08); color: var(--foreground); }
.alert-warn    { border-color: hsla(38, 92%, 50%, 0.35); background: hsla(45, 100%, 96%, 1); color: var(--foreground); }
.alert-danger  { border-color: hsla(0, 72%, 51%, 0.3); background: hsla(0, 72%, 51%, 0.08); color: var(--foreground); }

.alert .icon { flex-shrink: 0; margin-top: 0.125rem; }

/* ---------- Utility ---------- */
.row { display: flex; gap: 1rem; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 0.5rem; }
.gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; }
.text-muted { color: var(--muted-foreground); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-display { font-family: 'Space Grotesk', sans-serif; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.text-center { text-align: center; }
.text-gradient-gold {
  background: linear-gradient(135deg, hsl(42 100% 50%), hsl(38 90% 40%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.bg-gold-light { background: var(--gold-light); }
.shadow-card { box-shadow: 0 1px 3px hsl(222 47% 11% / 0.06), 0 4px 12px hsl(222 47% 11% / 0.04); }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.25rem; } .mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; } .mb-8 { margin-bottom: 2rem; }
.hidden { display: none !important; }
.inline-flex { display: inline-flex; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.w-full { width: 100%; }
.max-w-2xl { max-width: 42rem; margin-left: auto; margin-right: auto; }
.max-w-3xl { max-width: 48rem; margin-left: auto; margin-right: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all { word-break: break-all; }

.kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.875rem;
}
.kv-row + .kv-row { border-top: 1px dashed var(--border); }
.kv-row span:first-child { color: var(--muted-foreground); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, hsl(222 47% 11%) 0%, hsl(220 30% 20%) 100%);
  color: var(--primary-foreground);
  padding: 6rem 0;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 50%, hsl(42 100% 50% / 0.18), transparent 50%),
    radial-gradient(circle at 75% 50%, hsl(42 100% 50% / 0.10), transparent 50%);
  pointer-events: none;
  opacity: 0.9;
}
.hero-inner { position: relative; max-width: 48rem; margin: 0 auto; text-align: center; }
.hero h1 {
  font-size: 2.5rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
@media (min-width: 768px) { .hero h1 { font-size: 3.5rem; } }
@media (min-width: 1024px) { .hero h1 { font-size: 4rem; } }
.hero p {
  margin-top: 1.5rem;
  font-size: 1.125rem;
  color: hsla(45, 100%, 96%, 0.7);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}
.hero-actions {
  margin-top: 2.5rem;
  display: flex;
  gap: 0.75rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
@media (min-width: 640px) {
  .hero-actions { flex-direction: row; }
}

.section { padding: 4rem 0; }
.section h2 { font-size: 1.875rem; }
@media (min-width: 768px) { .section h2 { font-size: 2.25rem; } }
.section-eyebrow { color: var(--muted-foreground); margin-top: 0.5rem; max-width: 32rem; margin-left: auto; margin-right: auto; }

.feature-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 3rem;
}
@media (min-width: 768px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature-card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 1px 3px hsl(222 47% 11% / 0.06);
}
.feature-card .step-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.875rem;
  font-weight: 700;
  background: linear-gradient(135deg, hsl(42 100% 50%), hsl(38 90% 40%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Trust band */
.trust-band {
  background: hsl(220 16% 95%);
  border-top: 1px solid var(--border);
  padding: 4rem 0;
}
.stats-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 2rem;
}
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, hsl(42 100% 50%), hsl(38 90% 40%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-label { margin-top: 0.25rem; font-size: 0.875rem; color: var(--muted-foreground); }

/* ---------- Marketplace ---------- */
.market-banner {
  border-bottom: 1px solid var(--border);
  background: var(--gold-light);
}
.market-banner-row {
  padding: 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.filter-card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.filter-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr 1fr;
}
@media (min-width: 768px) {
  .filter-grid { grid-template-columns: repeat(5, 1fr); }
}

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

.empty-state {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 4rem 1.5rem;
  text-align: center;
}

.skeleton {
  border-radius: var(--radius);
  height: 12rem;
  background: linear-gradient(90deg, var(--secondary), hsl(220 16% 88%), var(--secondary));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Listing card */
.listing-card .avatar {
  width: 2rem; height: 2rem; border-radius: 9999px; background: var(--secondary);
  display: grid; place-items: center; color: var(--muted-foreground);
}
.amount-display { font-family: 'Space Grotesk', sans-serif; font-size: 1.125rem; font-weight: 600; }
.total-amount { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1rem;
  background: linear-gradient(135deg, hsl(42 100% 50%), hsl(38 90% 40%));
  -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Trade page */
.summary-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) { .summary-grid { grid-template-columns: repeat(3, 1fr); } }
.summary-tile {
  background: var(--secondary);
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
}
.summary-tile-label { font-size: 0.75rem; color: var(--muted-foreground); margin-bottom: 0.25rem; }
.summary-tile-value { font-family: 'Space Grotesk', sans-serif; font-size: 1.25rem; font-weight: 700; }

.steps {
  display: flex;
  gap: 0.25rem;
  margin-top: 1.5rem;
  overflow-x: auto;
}
.steps .step {
  flex: 1 1 0;
  min-width: 5rem;
  text-align: center;
  padding: 0.5rem 0.25rem;
  background: var(--secondary);
  color: var(--muted-foreground);
  border-radius: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.steps .step.done { background: var(--success); color: var(--success-foreground); }
.steps .step.active {
  background: linear-gradient(135deg, hsl(42 100% 50%), hsl(38 90% 40%));
  color: var(--accent-foreground);
}

.tx-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  color: var(--gold-dark);
  text-decoration: underline;
}

.spinner {
  width: 1rem; height: 1rem; border: 2px solid hsla(222, 47%, 11%, 0.15);
  border-top-color: var(--foreground); border-radius: 50%;
  display: inline-block; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.mobile-only { display: block; }
.desktop-only { display: none; }
@media (min-width: 768px) {
  .mobile-only { display: none; }
  .desktop-only { display: block; }
}
