
:root {
  --brand: #1b8cff;
  --brand-dark: #0d6efd;
  --brand-dim: rgba(27, 140, 255, 0.1);
  --brand-glow: rgba(27, 140, 255, 0.25);
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e8f0;
  --text: #111827;
  --muted: #6b7280;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gold: #d97706;
  --header-h: 64px;
}

html.theme-dark {
  --brand-dim: rgba(27, 140, 255, 0.18);
  --brand-glow: rgba(27, 140, 255, 0.35);
  --bg: #0d0f14;
  --surface: #161a22;
  --surface-2: #1e2430;
  --border: #2a3140;
  --text: #f3f4f6;
  --muted: #9ca3af;
}

html.theme-dark .site-header {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.theme-dark .lb-hero-card {
  background: linear-gradient(135deg, #161a22 0%, #1a2233 55%, #121820 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

html.theme-dark .lb-stat-box {
  background: rgba(255, 255, 255, 0.04);
}

html.theme-dark .gate-modal,
html.theme-dark .profile-modal,
html.theme-dark .panel,
html.theme-dark .lb-panel,
html.theme-dark .market-card {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

html.theme-dark .page-shell .card,
html.theme-dark .sidebar .card {
  background: #161a22 !important;
  border-color: #2a3140 !important;
  color: #f3f4f6;
}

html.theme-dark .card-header span:first-child,
html.theme-dark .profile-name,
html.theme-dark .estimate-value,
html.theme-dark .stat-value {
  color: #f3f4f6 !important;
}

html.theme-dark .stat-label,
html.theme-dark .estimate-sub,
html.theme-dark .estimate-note,
html.theme-dark .pack-hint {
  color: #9ca3af !important;
}

html.theme-dark .estimate-sub .num {
  color: #5bb8ff !important;
}

html.theme-dark .booster-carousel {
  background: #1e2430 !important;
  border-color: #2a3140 !important;
}

html.theme-dark .reply-host {
  background: #1e2430 !important;
}

html.theme-dark .modal {
  background: #161a22 !important;
  border-color: #2a3140 !important;
  color: #f3f4f6;
}

html.theme-dark .modal h2 {
  color: #f3f4f6 !important;
}

html.theme-dark .solver-option {
  background: #1e2430 !important;
  border-color: #2a3140 !important;
  color: #f3f4f6 !important;
}

html.theme-dark .field-input,
html.theme-dark .profile-username-edit input {
  background: #1e2430;
  border-color: #2a3140;
  color: #f3f4f6;
}

html.theme-dark .pack-dismiss {
  background: #161a22;
  color: #f3f4f6;
  border: 1px solid #2a3140;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

button, a, .wallet-chip, .profile-btn {
  touch-action: manipulation;
}

body.has-header {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

#siteHeader { flex-shrink: 0; width: 100%; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 32px;
  min-width: 0;
}

.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo-img {
  height: 32px;
  max-width: 140px;
  width: auto;
  display: block;
  object-fit: contain;
  object-position: left center;
}

.market-emoji img,
.trade-card-emoji img,
.meme-avatar,
.typer-avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2, #f0f2f5);
  display: block;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s;
}

.site-nav a:hover { color: var(--text); }
.site-nav a.active { color: var(--brand); font-weight: 600; }

.site-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.wallet-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.wallet-chip:hover {
  border-color: var(--brand);
  background: var(--brand-dim);
}

.wallet-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

.connect-wallet-btn {
  padding: 10px 20px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.connect-wallet-btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.connect-wallet-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.profile-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  overflow: hidden;
}

.profile-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-dim);
}

.profile-btn img { width: 100%; height: 100%; object-fit: cover; }
.profile-btn svg { width: 18px; height: 18px; }

.page-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 16px;
  background: var(--bg);
}

.page-shell .app {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  pointer-events: all;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.gate-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate-modal {
  width: min(440px, 94vw);
  background: var(--surface);
  border-radius: 24px;
  border: 1px solid var(--border);
  padding: 36px 32px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

.gate-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
}

.gate-logo img { width: 64px; height: 64px; display: block; }

.gate-modal h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  color: var(--text);
}

.gate-modal .gate-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 24px;
}

.gate-token-req {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text);
}

.gate-token-req strong { color: var(--brand); }

.gate-step {
  text-align: left;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 12px;
  background: var(--surface-2);
}

.gate-step.done {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.06);
}

.gate-step.fail {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.05);
}

.gate-step-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.gate-step-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.gate-step-value.ok { color: var(--success); }
.gate-step-value.bad { color: var(--danger); }

.gate-connect-btn {
  width: 100%;
  padding: 15px 20px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s;
  margin-top: 8px;
}

.gate-connect-btn:hover:not(:disabled) { background: var(--brand-dark); }
.gate-connect-btn:disabled { opacity: 0.55; cursor: wait; }

.gate-enter-btn {
  width: 100%;
  padding: 15px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  display: none;
}

.gate-enter-btn.visible { display: block; }
.gate-enter-btn:hover { opacity: 0.92; }

.gate-buy-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}

.gate-buy-link:hover { text-decoration: underline; }

.gate-error {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--danger);
  min-height: 18px;
}

.gate-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: gateSpin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes gateSpin { to { transform: rotate(360deg); } }

.profile-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.profile-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.profile-modal {
  width: min(420px, 94vw);
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 28px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12);
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.profile-overlay.open .profile-modal { transform: scale(1); }

.profile-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.profile-modal-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.profile-modal-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-modal-name {
  flex: 1;
  min-width: 0;
}

.profile-modal-name h3 {
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.profile-modal-name p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}

.profile-stat-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
}

.profile-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.profile-stat-row:last-child { border-bottom: none; }
.profile-stat-row span:first-child { color: var(--muted); font-weight: 500; }
.profile-stat-row span:last-child { font-weight: 700; color: var(--text); }
.profile-stat-row .token-ok { color: var(--success); }

.profile-username-edit {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.profile-username-edit input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.profile-username-edit input:focus { border-color: var(--brand); }

.profile-username-edit button {
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-btn-secondary {
  width: 100%;
  padding: 13px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.profile-btn-secondary:hover { background: var(--border); }

.profile-btn-danger {
  width: 100%;
  padding: 13px;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.profile-btn-danger:hover { background: rgba(239, 68, 68, 0.06); }

.profile-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-modal { position: relative; }

.profile-theme {
  margin-bottom: 16px;
}

.profile-sound-row {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.profile-theme-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.theme-toggle {
  display: flex;
  gap: 0;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.theme-toggle-btn {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.theme-toggle-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

html.theme-dark .theme-toggle-btn.active {
  background: var(--brand);
  color: #fff;
}

.leaderboard-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.leaderboard-page::-webkit-scrollbar { width: 6px; }
.leaderboard-page::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.lb-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.lb-hero {
  margin-bottom: 28px;
}

.lb-hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 55%, #eef6ff 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: 0 4px 24px rgba(27, 140, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.lb-hero-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.lb-hero-meta {
  text-align: left;
}

.lb-rank-pill {
  display: inline-block;
  margin-top: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--brand-dim);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.lb-hero-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.lb-stat-box {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
  min-width: 110px;
  text-align: left;
}

.lb-stat-box--wide {
  flex: 1;
  min-width: 160px;
}

.lb-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.lb-stat-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.lb-profile {
  text-align: center;
  margin-bottom: 40px;
}

.lb-avatar {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  margin: 0 auto 16px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.lb-hero .lb-avatar {
  width: 72px;
  height: 72px;
  margin: 0;
}

.lb-avatar img,
.lb-avatar svg { width: 100%; height: 100%; display: block; object-fit: cover; }

.lb-hero-meta .lb-handle {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0;
}

.lb-balance {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.lb-coin {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--brand);
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--brand-glow);
}

.lb-stats {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
}

.lb-panel {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.lb-title {
  padding: 22px 28px 18px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.lb-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.lb-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
}

.lb-table th {
  text-align: left;
  padding: 14px 28px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}

.lb-table th:nth-child(1) { width: 72px; }
.lb-table th:nth-child(3) { text-align: right; }

.lb-table td {
  padding: 16px 28px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.lb-table tr:last-child td { border-bottom: none; }
.lb-table tr.lb-you { background: var(--brand-dim); }
.lb-table tbody tr:hover:not(.lb-you) { background: var(--surface-2); }

.lb-rank {
  color: var(--muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.lb-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.lb-user-avatar svg { width: 100%; height: 100%; display: block; }
.lb-user-avatar.square { border-radius: 8px; }

.lb-claimed {
  text-align: right;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 600;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lb-claimed-inner {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.lb-coin-sm {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--brand);
  display: inline-block;
  flex-shrink: 0;
}

.content-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg);
}

.page-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.panel-title {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text);
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 14px;
  background: var(--surface);
}

.field-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover { background: var(--brand-dark); }

.form-status {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

.page-empty {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.trade-your-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trade-card-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, #fff, color-mix(in srgb, var(--card-color) 8%, #fff));
  min-width: 110px;
  border-top: 3px solid var(--card-color);
}

.trade-card-emoji {
  line-height: 1;
  display: flex;
  justify-content: center;
}
.trade-card-name { font-size: 12px; font-weight: 700; text-align: center; }
.trade-card-speed { font-size: 11px; color: var(--muted); }

.trade-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.trade-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.trade-request-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.trade-request-item:last-child { border-bottom: none; }

.trade-status-pill {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: capitalize;
}

.trade-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

.trade-accept-btn {
  align-self: flex-start;
  margin-top: 4px;
  padding: 6px 14px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.market-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  border-top: 4px solid var(--card-color);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s, box-shadow 0.15s;
}

.market-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--card-color) 15%, transparent);
}

.market-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.market-tier {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--card-color);
}

.market-owned,
.market-locked {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.market-owned {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.market-locked {
  background: var(--surface-2);
  color: var(--muted);
}

.market-emoji {
  line-height: 1;
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
}

.market-name {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.market-speed {
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--muted);
}

.market-pull-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.market-pull-label strong {
  color: var(--card-color);
  font-size: 14px;
}

.market-pull-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.market-pull-fill {
  height: 100%;
  background: var(--card-color);
  border-radius: 999px;
}

@media (max-width: 768px) {
  .site-header {
    padding: 0 16px;
    gap: 12px;
    height: auto;
    min-height: var(--header-h);
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .header-brand { flex: 1; gap: 16px; flex-wrap: wrap; }
  .site-nav { order: 3; width: 100%; gap: 20px; overflow-x: auto; }
  .connect-wallet-btn span.label { display: none; }

  .lb-inner { padding: 24px 16px 48px; }
  .lb-hero-card { flex-direction: column; align-items: stretch; }
  .lb-hero-stats { width: 100%; }
  .lb-stat-box { flex: 1; min-width: 0; }
  .trade-columns { grid-template-columns: 1fr; }
  .lb-balance { font-size: 28px; }
  .lb-table th, .lb-table td { padding-left: 16px; padding-right: 16px; }

  .page-shell { padding: 12px; }
  .page-shell .app { flex-direction: column; }
  .sidebar { width: 100%; max-height: 42vh; }

  .profile-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .profile-modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 22px 18px 28px;
    -webkit-overflow-scrolling: touch;
  }

  .market-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    padding-bottom: 24px;
  }

  .page-inner { padding: 24px 16px 48px; }
}

.info-tip-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.info-tip-overlay.open { opacity: 1; pointer-events: auto; }
.info-tip-modal {
  background: var(--surface, #fff); border-radius: 20px;
  padding: 28px 24px 24px; max-width: 360px; width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
  position: relative;
}
.info-tip-modal h3 { margin: 0 0 10px; font-size: 18px; }
.info-tip-modal p { margin: 0; color: var(--muted, #6b7280); font-size: 14px; line-height: 1.55; }
.info-tip-close {
  position: absolute; top: 12px; right: 14px;
  border: none; background: none; font-size: 24px; line-height: 1;
  color: var(--muted, #9ca3af); cursor: pointer;
}
