:root {
  --ps-bg: #000;
  --ps-panel: #0b0f0d;
  --ps-panel-2: #101612;
  --ps-line: rgba(255, 255, 255, 0.16);
  --ps-line-strong: rgba(255, 255, 255, 0.28);
  --ps-text: #f5fff9;
  --ps-muted: rgba(245, 255, 249, 0.68);
  --ps-faint: rgba(245, 255, 249, 0.46);
  --ps-accent: #00cc66;
  --ps-accent-2: #89f7b4;
  --ps-blue: #45a3ff;
  --ps-warn: #ffc857;
  --ps-danger: #ff5c7a;
  --ps-ok-text: #05200f;
  --ps-radius: 8px;
  --ps-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ps-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--ps-bg);
}

body {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background: var(--ps-bg);
  color: var(--ps-text);
  font-family: var(--ps-font);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--ps-accent-2);
  text-decoration: none;
}

a:hover,
a:focus {
  color: #fff;
}

/* Links are underlined on hover only; :where keeps this as weak as a plain a:hover. */
a:where(:not(.btn)):hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid rgba(0, 204, 102, 0.72);
  outline-offset: 2px;
}

.brand-mark {
  display: inline-block;
  color: var(--ps-accent);
  font-weight: 800;
}

.navbar-barter {
  border-bottom: 1px solid var(--ps-line);
  background: rgba(0, 0, 0, 0.94);
}

.navbar-barter .navbar-brand,
.navbar-barter .nav-link {
  color: var(--ps-text);
}

.navbar-barter .nav-link:hover,
.navbar-barter .nav-link:focus,
.navbar-barter .nav-link.active {
  color: var(--ps-accent-2);
}

.btn {
  min-height: 44px;
  border-radius: 8px;
}

.btn-barter {
  border: 1px solid var(--ps-line-strong);
  background: #070907;
  color: var(--ps-text);
  font-weight: 700;
}

.btn-barter:hover,
.btn-barter:focus {
  border-color: var(--ps-accent);
  color: #fff;
}

.btn-barter-primary {
  border-color: var(--ps-accent);
  background: var(--ps-accent);
  color: var(--ps-ok-text);
  font-weight: 800;
}

.btn-barter-primary:hover,
.btn-barter-primary:focus {
  border-color: var(--ps-accent-2);
  background: var(--ps-accent-2);
  color: var(--ps-ok-text);
}

.btn-barter-danger {
  border-color: rgba(255, 92, 122, 0.72);
  background: rgba(255, 92, 122, 0.12);
  color: #ffdce4;
  font-weight: 700;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero {
  position: relative;
  min-height: min(760px, 92vh);
  display: flex;
  align-items: center;
  padding: 96px 0 64px;
  overflow: hidden;
  border-bottom: 1px solid var(--ps-line);
  background: #000;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("img/pumpship.png");
  background-repeat: no-repeat;
  background-position: right 8vw center;
  background-size: min(52vw, 540px);
  opacity: 0.34;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.36);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 780px;
}

.hero h1 {
  max-width: 12ch;
  margin: 0 0 16px;
  font-size: 6.5rem;
  line-height: 0.9;
  font-weight: 900;
}

.hero-lead {
  max-width: 620px;
  color: var(--ps-muted);
  font-size: 1.35rem;
}

.example-task {
  position: relative;
  z-index: 1;
  max-width: 420px;
  border: 1px solid var(--ps-line);
  border-radius: var(--ps-radius);
  background: rgba(8, 12, 10, 0.86);
  padding: 18px;
}

.section-band {
  padding: 72px 0;
  border-bottom: 1px solid var(--ps-line);
}

.section-band.alt {
  background: #050705;
}

.section-title {
  margin: 0 0 24px;
  font-size: 3rem;
  font-weight: 850;
}

.quiet {
  color: var(--ps-muted);
}

.small-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ps-faint);
  font-family: var(--ps-mono);
  font-size: 0.78rem;
}

.rule-grid,
.path-grid,
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.path-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric,
.path-panel,
.tool-panel,
.project-card,
.profile-panel,
.empty-state,
.tx-panel {
  border: 1px solid var(--ps-line);
  border-radius: var(--ps-radius);
  background: var(--ps-panel);
}

.metric,
.path-panel,
.tool-panel,
.project-card,
.profile-panel,
.empty-state,
.tx-panel {
  padding: 18px;
}

.metric strong,
.stat-value {
  display: block;
  color: #fff;
  font-size: 1.45rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.table-darkish {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ps-text);
  --bs-table-border-color: var(--ps-line);
  color: var(--ps-text);
}

.table-darkish th {
  color: var(--ps-faint);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.faq-item {
  border-top: 1px solid var(--ps-line);
  padding: 18px 0;
}

.market-page {
  --ps-panel: #080808;
  --ps-panel-2: #101010;
  --ps-accent: #00cc00;
  --ps-accent-2: #7aef7a;
  --ps-radius: 3px;
  /* The brighter green stays readable as small status text on black. */
  --bs-success-rgb: 40, 167, 69;
  font-size: 14px;
}

.market-page h1,
.market-page h2,
.market-page h3,
.market-page h4,
.market-page h5,
.market-page h6 {
  font-weight: 900;
}

.market-shell {
  min-height: 100vh;
}

.market-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 56px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--ps-line);
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(16px);
}

.market-brand,
.market-brand:hover {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ps-text);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-decoration: none;
}

.market-brand .symbol {
  margin-right: 0.2em;
  color: #0d0;
  letter-spacing: -0.2em;
}

.market-mark {
  color: var(--ps-accent);
  font-family: var(--ps-mono);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.12em;
  padding-right: 0.12em;
}

.market-brand-label {
  color: var(--ps-muted);
}

.market-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.market-wallet-status {
  max-width: 320px;
  padding: 6px 10px;
  border: 1px solid var(--ps-line);
  color: var(--ps-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.market-actions .network-select {
  width: 138px;
  min-width: 0;
  flex: 0 0 auto;
}

.market-actions .btn,
.market-actions .form-select,
.market-refresh {
  min-height: 36px;
  border-radius: 2px;
  font-size: 0.78rem;
}

.market-actions .btn {
  min-width: 132px;
  white-space: nowrap;
}

.market-actions .btn-barter-primary {
  border-color: var(--ps-blue);
  background: transparent;
  color: #fff;
  text-transform: uppercase;
}

.market-actions .btn-barter-primary:hover,
.market-actions .btn-barter-primary:focus-visible {
  background: rgba(69, 163, 255, 0.15);
}

.app-shell {
  background: #000;
}

.market-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--ps-line);
  background: #080808;
}

.market-navigation .view-tabs {
  flex-wrap: nowrap;
  gap: 4px;
  padding: 0;
  overflow-x: auto;
  min-width: 0;
}

.market-navigation .view-tabs a {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--ps-muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.market-navigation .view-tabs a.active,
.market-navigation .view-tabs a:hover,
.market-navigation .view-tabs a:focus-visible {
  border-bottom-color: var(--ps-accent);
  background: rgba(0, 204, 0, 0.08);
  color: var(--ps-accent-2);
}

.market-refresh {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 4px 12px;
}

.market-statusbar {
  padding: 9px 16px;
  border-bottom: 1px solid var(--ps-line);
  font-size: 0.78rem;
}

.market-content {
  padding: 16px;
}

.market-intro {
  margin-bottom: 16px;
  font-size: 0.82rem;
}

.market-page .tool-panel,
.market-page .project-card,
.market-page .profile-panel,
.market-page .empty-state,
.market-page .tx-panel,
.market-page .metric {
  padding: 14px;
}

.market-page .app-grid {
  gap: 14px;
}

.market-page .form-select {
  color-scheme: dark;
  --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ccc' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.form-control,
.form-select {
  min-height: 44px;
  border: 1px solid var(--ps-line-strong);
  border-radius: 8px;
  background-color: #050705;
  color: var(--ps-text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ps-accent);
  background-color: #050705;
  color: var(--ps-text);
  box-shadow: 0 0 0 0.2rem rgba(0, 204, 102, 0.22);
}

.form-control::placeholder {
  color: var(--ps-faint);
}

.form-text,
.invalid-feedback,
.valid-feedback {
  color: var(--ps-muted);
}

.invalid-feedback {
  color: #ffadc0;
}

.view-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 18px 0 0;
}

.view-tabs a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ps-text);
  text-decoration: none;
}

.view-tabs a.active,
.view-tabs a:hover,
.view-tabs a:focus {
  border-color: var(--ps-accent);
  color: var(--ps-accent-2);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.project-list {
  display: grid;
  gap: 12px;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.project-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
}

.project-card-meta .token-line {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.project-card h3,
.tool-panel h2,
.tool-panel h3,
.profile-panel h2,
.profile-panel h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  line-height: 1.25;
}

.address,
.mono {
  font-family: var(--ps-mono);
  overflow-wrap: anywhere;
}

.status-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--ps-line);
  border-radius: 8px;
  padding: 3px 8px;
  color: var(--ps-text);
  font-size: 0.84rem;
  font-weight: 700;
}

.project-card .token-verification-badge {
  min-height: 0;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.status-open {
  border-color: rgba(0, 204, 102, 0.64);
  color: #b8ffd7;
}

.status-muted {
  color: var(--ps-muted);
}

.status-warn {
  border-color: rgba(255, 200, 87, 0.6);
  color: #ffe8ae;
}

.status-danger {
  border-color: rgba(255, 92, 122, 0.66);
  color: #ffadc0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.submission-list {
  display: grid;
  gap: 12px;
}

.submission-row {
  border: 1px solid var(--ps-line);
  border-radius: var(--ps-radius);
  padding: 14px;
  background: var(--ps-panel-2);
}

.proof-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tx-status {
  border-left: 4px solid var(--ps-line-strong);
  padding-left: 12px;
}

.tx-status.submitted {
  border-left-color: var(--ps-blue);
}

.tx-status.confirmed {
  border-left-color: var(--ps-accent);
}

.tx-status.failed {
  border-left-color: var(--ps-danger);
}

.toast-region {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1080;
  width: min(420px, calc(100vw - 32px));
}

.barter-toast {
  border: 1px solid var(--ps-line);
  border-radius: var(--ps-radius);
  background: #07100a;
  color: var(--ps-text);
  padding: 14px 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

.modal-content {
  border: 1px solid var(--ps-line);
  border-radius: var(--ps-radius);
  background: #060906;
  color: var(--ps-text);
}

.modal-header,
.modal-footer {
  border-color: var(--ps-line);
}

.btn-close {
  filter: invert(1);
}

.footer-barter {
  padding: 36px 0;
  color: var(--ps-muted);
  background: #000;
}

.footer-barter a {
  color: var(--ps-text);
}

[aria-live] {
  min-height: 1.25rem;
}

@media (max-width: 991.98px) {
  .hero {
    min-height: auto;
    padding: 88px 0 48px;
  }

  .hero h1 {
    font-size: 4.5rem;
  }

  .hero-lead {
    font-size: 1.18rem;
  }

  .section-title {
    font-size: 2.35rem;
  }

  .hero::before {
    background-position: right -80px top 72px;
    background-size: 360px;
    opacity: 0.22;
  }

  /* minmax(0, ...) keeps unbreakable on-chain text from widening the page. */
  .rule-grid,
  .metrics-grid,
  .path-grid,
  .app-grid,
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .market-topbar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .market-wallet-status {
    max-width: 220px;
  }

  .project-card {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 575.98px) {
  body {
    font-size: 15px;
  }

  .section-band {
    padding: 48px 0;
  }

  .btn-row,
  .split-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .view-tabs a {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }
}

/* Public browsing and drafts remain usable before connecting a wallet. */
.address-lookup {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.address-lookup input {
  flex: 1 1 18rem;
  min-width: 0;
}

#createSummary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

aside.tool-panel > .metrics-grid:not(#createSummary) {
  grid-template-columns: 1fr;
}

.tool-panel, .profile-panel, .metric, .project-card, .project-card > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.form-error {
  margin: 10px 0 0;
  color: #ffadc0;
}

.form-error:empty {
  display: none;
}

.token-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.confirm-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 14px;
  margin: 0 0 12px;
}

.confirm-list dt {
  color: var(--ps-muted);
  font-weight: 400;
}

.confirm-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.barter-toast a {
  margin-left: 8px;
}

@media (max-width: 575.98px) {
  #createSummary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .market-topbar {
    position: static;
    padding: 12px;
  }

  .market-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
  }

  .market-wallet-status {
    grid-column: 1 / -1;
    max-width: none;
    padding: 0;
    border: 0;
  }

  .market-actions .network-select,
  .market-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .market-navigation {
    gap: 8px;
    padding: 0 12px;
  }

  .market-navigation .view-tabs a {
    padding: 0 10px;
  }

  .market-statusbar,
  .market-content {
    padding: 12px;
  }

  .market-refresh {
    min-height: 44px;
  }
}
