/* ============ TOKENS ============ */
:root {
  /* Type */
  --f-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Palette — muted paper + one warm accent */
  --bg: #f5f2ec;                /* warm off-white */
  --bg-elev: #ffffff;
  --line: #e3ddd0;
  --line-strong: #cfc7b3;
  --ink: #1a1712;               /* near-black warm */
  --ink-2: #4a463d;
  --ink-3: #7a7566;
  --ink-mute: #a19a86;

  --yes: #227754;               /* deep green */
  --yes-bg: #dbeadf;
  --no: #a63131;                /* deep red */
  --no-bg: #f2dede;

  --accent: #d95d1b;            /* burnt orange — for CTA + hover */
  --accent-hover: #b64a10;

  --shadow-sm: 0 1px 0 rgba(20,15,5,0.04);
  --shadow-md: 0 8px 24px -12px rgba(20,15,5,0.15), 0 1px 0 rgba(20,15,5,0.04);
  --shadow-lg: 0 24px 60px -24px rgba(20,15,5,0.25);

  --radius: 6px;
  --radius-lg: 10px;

  --wrap: 1240px;
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--f-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.mono { font-family: var(--f-mono); font-feature-settings: "tnum" 1, "zero" 1; }
em { font-style: italic; color: var(--ink-2); }
code { font-family: var(--f-mono); background: rgba(217,93,27,0.08); padding: 1px 5px; border-radius: 3px; font-size: 0.92em; }

.container { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .container { padding: 0 16px; } }

/* ============ NAV ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245,242,236,0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 32px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand__mark { width: 26px; height: 26px; color: var(--accent); }
.brand__wordmark {
  font-family: var(--f-mono); font-weight: 700; letter-spacing: 0.06em; font-size: 18px;
}
.brand__net {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em;
  padding: 2px 6px; border: 1px solid var(--line-strong); color: var(--ink-3); border-radius: 3px;
}
.nav__links { display: flex; gap: 4px; }
.nav__link {
  padding: 8px 12px; border-radius: var(--radius); color: var(--ink-2);
  font-size: 14px; font-weight: 500; transition: color 0.15s, background 0.15s;
}
.nav__link:hover { color: var(--ink); background: rgba(20,15,5,0.04); }
.nav__link.is-active { color: var(--ink); background: rgba(20,15,5,0.06); }
.nav__wallet { display: flex; align-items: center; gap: 12px; }
.net-chip {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em;
  padding: 4px 8px; border-radius: 999px; background: var(--yes-bg); color: var(--yes);
}
.net-chip.is-wrong { background: var(--no-bg); color: var(--no); }
@media (max-width: 720px) {
  .nav__links { display: none; }
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid transparent; font-weight: 600; font-size: 14px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: var(--accent); }
.btn--primary:disabled { background: var(--ink-mute); cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); background: rgba(20,15,5,0.04); }
.btn--wide { width: 100%; }

/* ============ HERO ============ */
.hero { padding: 80px 0 56px; }
.hero__eyebrow {
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.12em;
  color: var(--ink-3); text-transform: uppercase; margin-bottom: 20px;
}
.hero__title {
  font-size: clamp(36px, 5.5vw, 64px); line-height: 1.02;
  font-weight: 700; letter-spacing: -0.02em; margin: 0 0 20px;
  max-width: 900px;
}
.hero__lede {
  font-size: 18px; line-height: 1.55; color: var(--ink-2);
  max-width: 720px; margin: 0 0 40px;
}
.hero__lede strong { color: var(--ink); }
.hero__stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
  border-top: 1px solid var(--line-strong); padding-top: 28px;
}
.stat__val {
  display: block; font-family: var(--f-mono); font-size: 28px; font-weight: 500;
  letter-spacing: -0.01em; color: var(--ink);
}
.stat__lab {
  display: block; font-size: 12px; color: var(--ink-3);
  margin-top: 4px; letter-spacing: 0.02em;
}
@media (max-width: 720px) {
  .hero { padding: 48px 0 32px; }
  .hero__stats { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

/* ============ GRID ============ */
.grid-wrap { padding: 32px 0 96px; }
.grid-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.grid-head__title { font-size: 20px; font-weight: 600; }
.grid-head__filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-strong); background: transparent;
  padding: 6px 12px; border-radius: 999px; color: var(--ink-2);
  font-size: 13px; font-weight: 500;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.markets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.market-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  cursor: pointer; transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
  min-height: 176px;
}
.market-card:hover {
  border-color: var(--line-strong); transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.market-card__head {
  display: flex; align-items: center; justify-content: space-between;
}
.market-card__id {
  font-family: var(--f-mono); font-size: 12px; color: var(--ink-3);
  letter-spacing: 0.06em;
}
.market-card__state {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.08em;
  padding: 3px 7px; border-radius: 3px; text-transform: uppercase; font-weight: 500;
}
.state--open { background: var(--yes-bg); color: var(--yes); }
.state--locked { background: rgba(217,93,27,0.12); color: var(--accent); }
.state--resolved { background: rgba(20,15,5,0.08); color: var(--ink); }
.state--unset { background: transparent; color: var(--ink-mute); border: 1px dashed var(--line-strong); }

.market-card__q {
  font-size: 15px; font-weight: 500; line-height: 1.35; color: var(--ink);
  flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.market-card__q--empty { color: var(--ink-mute); font-style: italic; font-weight: 400; }
.market-card__prices {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.mc-price { display: flex; flex-direction: column; }
.mc-price__lab { font-size: 10px; letter-spacing: 0.08em; color: var(--ink-3); text-transform: uppercase; }
.mc-price__val { font-family: var(--f-mono); font-size: 16px; font-weight: 500; }
.mc-price.is-yes .mc-price__val { color: var(--yes); }
.mc-price.is-no .mc-price__val { color: var(--no); }
.mc-price__bar {
  height: 3px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden;
}
.mc-price__bar span { display:block; height: 100%; background: currentColor; transition: width 0.3s; }
.mc-price.is-yes .mc-price__bar { color: var(--yes); }
.mc-price.is-no .mc-price__bar { color: var(--no); }

.market-card__foot {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--f-mono); font-size: 11px; color: var(--ink-3);
}

/* ============ TRADE PAGE ============ */
.page__title { font-size: 32px; font-weight: 700; letter-spacing: -0.01em; margin: 40px 0 24px; }
.trade { padding: 24px 0 80px; }
.trade__back {
  display: inline-block; margin-bottom: 24px; color: var(--ink-3); font-size: 14px;
}
.trade__back:hover { color: var(--ink); }
.trade__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px;
}
@media (max-width: 960px) {
  .trade__grid { grid-template-columns: 1fr; }
}
.trade__id {
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.12em;
  color: var(--ink-3); margin-bottom: 8px;
}
.trade__question {
  font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em;
  margin: 0 0 16px;
}
.trade__meta {
  display: flex; flex-wrap: wrap; gap: 20px; font-size: 13px; color: var(--ink-3);
  margin-bottom: 32px; padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.meta__lab {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; margin-right: 4px;
}

/* Price band */
.price-band {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px;
}
.price-block {
  background: var(--bg-elev); border-radius: var(--radius-lg);
  padding: 20px 24px; border: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.price-block::before {
  content: ""; position: absolute; inset: 0; opacity: 0.15;
}
.price-block.is-yes::before { background: linear-gradient(90deg, var(--yes-bg), transparent); }
.price-block.is-no::before { background: linear-gradient(90deg, var(--no-bg), transparent); }
.price-block__lab {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em;
  font-weight: 600; text-transform: uppercase; margin-bottom: 6px;
  position: relative;
}
.price-block.is-yes .price-block__lab { color: var(--yes); }
.price-block.is-no .price-block__lab { color: var(--no); }
.price-block__val {
  font-family: var(--f-mono); font-size: 40px; font-weight: 500;
  letter-spacing: -0.02em; position: relative;
}

.chart {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px; margin-bottom: 24px;
}
.chart canvas { width: 100%; height: auto; display: block; }

.details {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 8px 20px;
}
.details__row {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.details__row:last-child { border-bottom: 0; }
.details__row span:first-child { color: var(--ink-3); }
.details__row span:last-child { color: var(--ink); }

.owner-panel {
  margin-top: 24px; background: linear-gradient(135deg, #fff9f2 0%, #fff 100%);
  border: 1px solid var(--accent); border-radius: var(--radius-lg); padding: 20px;
}
.owner-panel__head {
  font-weight: 600; color: var(--accent); margin-bottom: 8px;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
}
.owner-panel__body { font-size: 14px; color: var(--ink-2); margin: 0 0 16px; }
.owner-panel__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Trade card (right column) */
.trade-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-md);
  position: sticky; top: 88px;
}
.side-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg); padding: 4px; border-radius: var(--radius); margin-bottom: 16px;
  border: 1px solid var(--line);
}
.side-toggle__btn {
  border: 0; background: transparent; padding: 8px; border-radius: 4px;
  font-weight: 600; color: var(--ink-3); font-size: 14px;
}
.side-toggle__btn.is-active[data-side="0"] { background: var(--yes); color: #fff; }
.side-toggle__btn.is-active[data-side="1"] { background: var(--no); color: #fff; }

.amount { display: block; margin-bottom: 8px; }
.amount__lab {
  display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.amount input {
  width: 100%; padding: 12px 14px; font-family: var(--f-mono); font-size: 18px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg);
  color: var(--ink); outline: none; transition: border-color 0.15s;
}
.amount input:focus { border-color: var(--ink); }

.quick { display: flex; gap: 6px; margin-bottom: 16px; }
.quick__btn {
  flex: 1; padding: 6px 8px; font-family: var(--f-mono); font-size: 12px;
  border: 1px solid var(--line-strong); background: transparent; border-radius: 4px;
  color: var(--ink-2);
}
.quick__btn:hover { border-color: var(--ink); color: var(--ink); }

.preview {
  background: var(--bg); padding: 12px 14px; border-radius: var(--radius);
  margin-bottom: 16px; border: 1px solid var(--line);
}
.preview__row {
  display: flex; justify-content: space-between; font-size: 13px;
  padding: 4px 0;
}
.preview__row:first-child { padding-top: 0; }
.preview__row:last-child { padding-bottom: 0; }
.preview__row span:first-child { color: var(--ink-3); }

.tx-status {
  margin-top: 12px; font-family: var(--f-mono); font-size: 12px;
  min-height: 18px; color: var(--ink-3);
}
.tx-status a { color: var(--accent); text-decoration: underline; }
.tx-status.is-error { color: var(--no); }
.tx-status.is-success { color: var(--yes); }

.position {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
}
.position__head {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px;
}
.position__row {
  display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0;
}
.position__row span:first-child { color: var(--ink-3); }

/* ============ PORTFOLIO / ABOUT ============ */
.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
  padding: 60px 20px; text-align: center;
}
.empty__title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.empty__sub { color: var(--ink-3); font-size: 14px; }

.port-section { margin-bottom: 40px; }
.port-section__title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.port-nfts, .port-positions {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px;
}
.port-item {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; font-size: 13px;
}
.port-item strong { display: block; font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }

.about__lede {
  font-size: 20px; line-height: 1.5; color: var(--ink-2); margin: 0 0 40px; max-width: 720px;
}
.about h3 { margin: 32px 0 12px; font-size: 18px; font-weight: 600; }
.about__ol { padding-left: 20px; }
.about__ol li { margin-bottom: 14px; max-width: 720px; line-height: 1.55; }
.tbl {
  border-collapse: collapse; width: 100%; max-width: 720px; font-size: 14px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { color: var(--ink-3); width: 30%; }

/* ============ FOOTER ============ */
.footer { border-top: 1px solid var(--line); padding: 32px 0; color: var(--ink-3); font-size: 13px; }
.footer__inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer__links { display: flex; gap: 20px; }
.footer__links a:hover { color: var(--ink); }

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: var(--ink); color: #fff; padding: 14px 20px; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 14px; max-width: 380px;
  animation: toast-in 0.2s ease-out;
}
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } }
.toast.is-error { background: var(--no); }
.toast.is-success { background: var(--yes); }

/* ============ SKELETON ============ */
.skel {
  background: linear-gradient(90deg, var(--line) 0%, var(--bg) 50%, var(--line) 100%);
  background-size: 200% 100%; animation: skel 1.4s infinite;
  border-radius: 3px;
}
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
