:root {
  --bg: #061726;
  --panel: rgba(7, 27, 44, 0.94);
  --panel-soft: rgba(13, 43, 64, 0.78);
  --line: rgba(79, 180, 203, 0.32);
  --line-strong: rgba(53, 221, 205, 0.6);
  --text: #f4fbff;
  --muted: #a7c0cf;
  --mint: #22e5c2;
  --cyan: #19aede;
  --danger: #ff7272;
  --gold: #ffd976;
  --shadow: 0 24px 70px rgba(0, 7, 18, 0.35);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(circle at 8% 3%, rgba(28, 113, 159, 0.38), transparent 31rem),
    radial-gradient(circle at 92% 20%, rgba(8, 117, 93, 0.28), transparent 28rem),
    linear-gradient(145deg, #061a2b 0%, #071725 52%, #071b25 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(88, 188, 205, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 188, 205, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.market-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 36px));
  margin: 66px auto 72px;
}

.market-hero,
.market-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.market-hero {
  position: relative;
  isolation: isolate;
  min-height: 272px;
  padding: 48px 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 42px;
  overflow: hidden;
  border-radius: 26px;
  background:
    linear-gradient(115deg, rgba(8, 31, 50, 0.98) 0%, rgba(7, 36, 52, 0.94) 57%, rgba(5, 59, 65, 0.9) 100%);
}

.market-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(135deg, transparent 49%, rgba(35, 229, 194, 0.06) 49.5%, transparent 50%),
    radial-gradient(circle at 75% 30%, rgba(20, 207, 187, 0.16), transparent 25%);
}

.hero-orb {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}

.hero-orb-one {
  width: 220px;
  height: 220px;
  right: 18%;
  bottom: -155px;
  border: 35px solid rgba(25, 174, 222, 0.08);
}

.hero-orb-two {
  width: 110px;
  height: 110px;
  right: -28px;
  top: -42px;
  background: rgba(34, 229, 194, 0.07);
}

.hero-copy { max-width: 710px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #7eeedb !important;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint), var(--cyan));
  box-shadow: 0 0 16px rgba(34, 229, 194, 0.55);
}

.market-hero h1 {
  margin: 17px 0 16px;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.045em;
  text-shadow: 0 6px 28px rgba(0, 0, 0, 0.24);
}

.market-hero p {
  margin: 0;
  color: #bfd1dc;
  line-height: 1.8;
  font-size: 16px;
}

.trust-strip {
  flex: 0 0 250px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.trust-strip span {
  min-height: 74px;
  padding: 14px 10px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px solid rgba(91, 196, 211, 0.35);
  border-radius: 17px;
  color: #e8fbff;
  background: rgba(10, 42, 61, 0.72);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  backdrop-filter: blur(12px);
}

.trust-strip span::before {
  color: var(--mint);
  font-size: 18px;
  line-height: 1;
}
.trust-strip span:nth-child(1)::before { content: "◇"; }
.trust-strip span:nth-child(2)::before { content: "▣"; }
.trust-strip span:nth-child(3)::before { content: "⌕"; }
.trust-strip span:nth-child(4)::before { content: "↗"; }

.market-tabs {
  position: relative;
  margin: 18px 0;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  border: 1px solid rgba(58, 137, 160, 0.25);
  border-radius: 17px;
  background: rgba(5, 24, 39, 0.78);
  box-shadow: 0 12px 35px rgba(0, 6, 15, 0.18);
  backdrop-filter: blur(14px);
}

.tab,
.primary,
.secondary,
.danger {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 18px;
  color: #fff;
  background: #102c42;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.tab {
  border-color: transparent;
  background: transparent;
  color: #afc7d5;
}

.tab:hover,
.secondary:hover {
  color: #fff;
  border-color: var(--line-strong);
  background: rgba(22, 63, 83, 0.72);
}

.tab.active,
.primary {
  border-color: rgba(79, 237, 219, 0.72);
  color: #fff;
  background: linear-gradient(135deg, #079d87, #0b9dca);
  box-shadow: 0 10px 25px rgba(2, 147, 148, 0.23), inset 0 1px rgba(255, 255, 255, 0.16);
}

.tab.active { box-shadow: 0 8px 24px rgba(2, 147, 148, 0.2); }
.tab:active, .primary:active, .secondary:active { transform: translateY(1px); }
button:disabled { opacity: 0.58; cursor: wait; }
.danger { border-color: #934949; background: #4b2530; }

.market-panel {
  display: none;
  padding: 30px;
  border-radius: 24px;
}
.market-panel.active { display: block; }

.safety-note {
  margin-bottom: 30px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(237, 193, 81, 0.38);
  border-radius: 15px;
  color: #f9e8b3;
  background: linear-gradient(90deg, rgba(151, 107, 12, 0.18), rgba(95, 73, 21, 0.09));
}

.safety-note > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.safety-note strong { flex: 0 0 auto; color: #ffe99d; }
.safety-note span { color: #d8ceb0; line-height: 1.6; }

.safety-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #2b2513 !important;
  background: #f2d268;
  font-weight: 950;
  box-shadow: 0 0 20px rgba(242, 210, 104, 0.2);
}

.section-heading {
  margin-bottom: 26px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

.section-heading h2 {
  position: relative;
  margin: 0 0 9px;
  padding-left: 16px;
  font-size: 29px;
  letter-spacing: -0.02em;
}

.section-heading h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 3px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(var(--mint), var(--cyan));
  box-shadow: 0 0 14px rgba(34, 229, 194, 0.4);
}

.section-heading p { margin: 0; color: var(--muted); }

.market-filters {
  width: min(100%, 510px);
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) minmax(150px, 0.8fr);
  gap: 10px;
}

.search-control {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid #35657d;
  border-radius: 13px;
  background: #112f46;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.search-control:focus-within {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(34, 229, 194, 0.1);
}

.search-control > span { padding-left: 14px; color: #80a6b8; font-size: 22px; }
.search-control input { min-width: 0; border: 0; background: transparent; box-shadow: none; }
.search-control .primary { margin: 4px; padding: 9px 16px; border-radius: 9px; }

.field { display: grid; gap: 7px; }
.field label { color: #dffaff; font-weight: 800; }
.field small { color: var(--muted); }

input,
select,
textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #35657d;
  border-radius: 11px;
  outline: none;
  color: #fff;
  background: #112f46;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(34, 229, 194, 0.1);
}

textarea { min-height: 120px; resize: vertical; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #0e2c42, #091e31);
  box-shadow: 0 12px 30px rgba(0, 7, 18, 0.22);
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.product-card:hover {
  transform: translateY(-6px);
  border-color: var(--mint);
  box-shadow: 0 20px 42px rgba(0, 8, 20, 0.34), 0 0 0 1px rgba(34, 229, 194, 0.12);
}

.product-card img,
.product-card video {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: #fff;
}

.product-card-body { padding: 17px; }
.product-card h3 { margin: 0 0 8px; font-size: 18px; }
.product-card-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.price { margin: 10px 0; color: var(--gold); font-size: 25px; font-weight: 900; }

.empty-state,
.gate-card {
  min-height: 220px;
  padding: 38px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed rgba(70, 173, 198, 0.46);
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(24, 174, 193, 0.11), transparent 32%),
    rgba(11, 39, 58, 0.55);
}

.empty-state strong,
.gate-card h3 { margin: 0; color: var(--text); font-size: 21px; }

.empty-illustration {
  width: 78px;
  height: 78px;
  margin-bottom: 7px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(44, 221, 197, 0.26);
  border-radius: 23px;
  color: var(--mint);
  background: linear-gradient(145deg, rgba(34, 229, 194, 0.12), rgba(25, 174, 222, 0.06));
  transform: rotate(-3deg);
  box-shadow: 0 14px 32px rgba(0, 8, 20, 0.28);
}

.empty-illustration svg {
  width: 52px;
  height: 52px;
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.listing-composer {
  margin: 0 0 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0c263a;
}
.listing-composer summary { padding: 17px 19px; color: var(--mint); font-size: 20px; font-weight: 900; cursor: pointer; user-select: none; }
.listing-composer[open] summary { border-bottom: 1px solid var(--line); }
.listing-help { margin: 18px 18px 0; color: var(--muted); line-height: 1.6; }
.market-form { padding: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.wide { grid-column: 1 / -1; }
.form-note { margin: 0; color: var(--muted); }

.upload-preview { display: flex; gap: 10px; flex-wrap: wrap; }
.upload-preview img,
.upload-preview video { width: 100px; height: 100px; object-fit: cover; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.qr-preview img { object-fit: contain; }

.seller-list { margin: 12px 0 28px; display: grid; gap: 12px; }
.seller-row,
.order-card { padding: 16px; display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 14px; background: #0c263a; }
.seller-row { grid-template-columns: 72px 1fr auto; align-items: center; }
.seller-row img,
.seller-row video { width: 72px; height: 72px; object-fit: cover; border-radius: 9px; background: #fff; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.order-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; color: var(--muted); }

.lookup-form { max-width: 880px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: end; }
.market-dialog { width: min(760px, calc(100% - 28px)); max-height: 90vh; overflow: auto; padding: 28px; border: 1px solid var(--line); border-radius: 20px; color: #fff; background: #081d2f; box-shadow: 0 28px 90px #000; }
.market-dialog::backdrop { background: rgba(0, 7, 16, 0.82); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 14px; top: 10px; border: 0; color: #fff; background: transparent; font-size: 32px; cursor: pointer; }
.detail-gallery { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.detail-gallery img,
.detail-gallery video { width: 100%; height: 340px; object-fit: contain; border-radius: 12px; background: #fff; }
.detail-gallery .thumbs { display: grid; gap: 8px; }
.detail-gallery .thumbs img,
.detail-gallery .thumbs video { height: 78px; object-fit: cover; }
.detail-description { color: #c5d8e4; white-space: pre-wrap; line-height: 1.7; }
.checkout-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkout-form .wide { grid-column: 1 / -1; }
.payment-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.payment-choice label { padding: 15px; border: 1px solid var(--line); border-radius: 10px; }
.payment-screen { text-align: center; }
.payment-screen img { width: min(330px, 80%); aspect-ratio: 1; object-fit: contain; display: block; margin: 18px auto; border-radius: 14px; background: #fff; }
.order-number { color: var(--mint); font-family: monospace; font-size: 18px; overflow-wrap: anywhere; }
.status-pill { display: inline-block; padding: 5px 10px; border-radius: 999px; color: #c9f7ee; background: #173b50; font-weight: 800; }
.pagination { margin-top: 24px; display: flex; justify-content: center; align-items: center; gap: 12px; color: var(--muted); }
.pagination button:disabled { opacity: 0.42; cursor: not-allowed; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; padding: 13px 20px; border: 1px solid var(--mint); border-radius: 12px; color: #fff; background: #14364c; box-shadow: 0 15px 45px rgba(0, 0, 0, 0.35); transform: translate(-50%, 120px); transition: 0.25s; }
.toast.show { transform: translate(-50%, 0); }
[hidden]{display:none!important}

@media (max-width: 900px) {
  .market-hero { padding: 40px; }
  .trust-strip { flex-basis: 220px; }
  .section-heading { align-items: stretch; display: grid; }
  .market-filters { width: 100%; }
}

@media (max-width: 680px) {
  .market-shell { width: min(calc(100% - 18px), 1240px); margin-top: 58px; }
  .market-hero { min-height: auto; padding: 28px 23px; display: block; border-radius: 20px; }
  .market-hero h1 { margin-top: 14px; font-size: clamp(38px, 12vw, 54px); }
  .market-hero p { font-size: 14px; }
  .trust-strip { margin-top: 25px; grid-template-columns: 1fr 1fr; }
  .trust-strip span { min-height: 66px; padding: 10px 8px; white-space: normal; }
  .market-tabs { position: sticky; top: 8px; z-index: 10; }
  .tab { padding: 12px 7px; font-size: 14px; }
  .market-panel { padding: 18px; border-radius: 20px; }
  .safety-note { align-items: flex-start; }
  .safety-note > div { display: grid; gap: 3px; }
  .section-heading h2 { font-size: 25px; }
  .market-filters { grid-template-columns: 1fr; }
  .search-control { grid-template-columns: auto minmax(0, 1fr) auto; }
  .market-form,
  .checkout-form,
  .lookup-form { grid-template-columns: 1fr; }
  .wide,
  .checkout-form .wide { grid-column: auto; }
  .seller-row { grid-template-columns: 56px 1fr; }
  .seller-row .row-actions { grid-column: 1 / -1; }
  .detail-gallery { grid-template-columns: 1fr; }
  .detail-gallery .thumbs { grid-template-columns: repeat(4, 1fr); }
  .detail-gallery img,
  .detail-gallery video { height: 260px; }
  .detail-gallery .thumbs img,
  .detail-gallery .thumbs video { height: 60px; }
  .empty-state { min-height: 250px; padding: 26px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
