/* /buy — swap deck: live stats band, cross-chain swap widget, ARROW/WETH chart.
   Local palette mirrors production's standalone buy page (#fafafa/#000);
   only fonts and --accent map cleanly to base tokens. Container 1160/28 and
   980/720/560 breakpoints match the other buy-page sections. */

.s-buy-deck {
  --b-bg: #fafafa;
  --b-panel: #ffffff;
  --b-line: #e6e6e6;
  --b-line2: #d0d0d0;
  --b-ink: #0a0b04;
  --b-muted: #4d4d4d;
  --b-faint: #6b6b6b;
}
html.dark .s-buy-deck {
  --b-bg: #000000;
  --b-panel: rgba(244, 247, 236, 0.03);
  --b-line: rgba(244, 247, 236, 0.1);
  --b-line2: rgba(244, 247, 236, 0.17);
  --b-ink: #f5f6ef;
  --b-muted: rgba(245, 246, 239, 0.64);
  --b-faint: rgba(245, 246, 239, 0.42);
}

.s-buy-deck .bd-wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 28px;
  overflow-x: clip;
}

.s-buy-deck .bd-lbl {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--b-faint);
}

/* ---- live data band ---- */
.s-buy-deck .bd-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--b-ink);
  border-bottom: 1px solid var(--b-line);
}
.s-buy-deck .bd-cell {
  padding: 24px 26px 26px;
  border-left: 1px solid var(--b-line);
  min-width: 0;
}
.s-buy-deck .bd-cell:first-child {
  border-left: 0;
  padding-left: 0;
}
.s-buy-deck .bd-cell .bd-lbl {
  display: block;
  margin-bottom: 12px;
}
.s-buy-deck .bd-v {
  display: block;
  font-family: var(--font-body);
  font-size: clamp(26px, 2.6vw, 36px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--b-ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  word-break: break-word;
}

/* ---- trade deck ---- */
.s-buy-deck .bd-deck {
  display: grid;
  grid-template-columns: minmax(0, 438px) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  margin-top: 26px;
}
.s-buy-deck .bd-colL,
.s-buy-deck .bd-colR {
  min-width: 0;
}

/* frame */
.s-buy-deck .bd-frame {
  border: 1px solid var(--b-line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--b-panel);
  max-width: 438px;
}
.s-buy-deck .bd-framehead {
  background: #0a0b04;
  color: #fff;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
html.dark .s-buy-deck .bd-framehead {
  border-bottom: 1px solid var(--b-line);
}
.s-buy-deck .bd-frametitle {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 700;
}
.s-buy-deck .bd-framenet {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.66);
}
.s-buy-deck .bd-rh {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}
.s-buy-deck .bd-framebody {
  padding: 14px 14px 8px;
  display: flex;
  justify-content: center;
}
.s-buy-deck .bd-swap {
  width: 100%;
  min-width: 0;
  max-width: 408px;
  display: flex;
  flex-direction: column;
}

/* swap cards */
.s-buy-deck .bd-card {
  background: var(--b-bg);
  border: 1px solid var(--b-line);
  border-radius: 5px;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
html.dark .s-buy-deck .bd-card {
  background: rgba(244, 247, 236, 0.014);
}
.s-buy-deck .bd-cardhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.s-buy-deck .bd-side {
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--b-faint);
}
.s-buy-deck .bd-cardrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.s-buy-deck .bd-amt {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  outline: none;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: -0.02em;
  color: var(--b-ink);
  font-variant-numeric: tabular-nums;
}
.s-buy-deck .bd-amt::placeholder {
  color: var(--b-line2);
  opacity: 1;
}
html.dark .s-buy-deck .bd-amt::placeholder {
  color: rgba(245, 246, 239, 0.22);
}

/* token pill */
.s-buy-deck .bd-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  background: var(--b-panel);
  border: 1px solid var(--b-line);
  border-radius: 4px;
  padding: 7px 11px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.s-buy-deck .bd-pill:hover {
  border-color: var(--b-line2);
}
.s-buy-deck .bd-pill-static {
  cursor: default;
}
.s-buy-deck .bd-pill-static:hover {
  border-color: var(--b-line);
}
.s-buy-deck .bd-pill-ic {
  position: relative;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}
.s-buy-deck .bd-pill-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #fff;
}
.s-buy-deck .bd-pill-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  border: 1.5px solid var(--b-panel);
}
.s-buy-deck .bd-pill-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.s-buy-deck .bd-pill-tk {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  min-width: 0;
}
.s-buy-deck .bd-pill-sym {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.005em;
  color: var(--b-ink);
}
.s-buy-deck .bd-pill-sub {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11.5px;
  color: var(--b-faint);
}
.s-buy-deck .bd-pill-chev {
  width: 12px;
  height: 14px;
  margin-left: 2px;
  flex: 0 0 auto;
  color: var(--b-line2);
}

/* fiat row */
.s-buy-deck .bd-fiatrow {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}
.s-buy-deck .bd-fiatrow > span {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--b-faint);
  font-variant-numeric: tabular-nums;
}
.s-buy-deck .bd-modetoggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--b-faint);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.s-buy-deck .bd-modetoggle:hover {
  opacity: 1;
}
.s-buy-deck .bd-modetoggle svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* flip control */
.s-buy-deck .bd-flip {
  position: relative;
  z-index: 3;
  width: 34px;
  height: 34px;
  margin: -8px auto;
}
.s-buy-deck .bd-flipbtn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--b-panel);
  border: 1px solid var(--b-line2);
  border-radius: 4px;
  color: var(--b-ink);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.s-buy-deck .bd-flipbtn:hover {
  border-color: var(--b-ink);
}
.s-buy-deck .bd-flipbtn svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* connect wallet */
.s-buy-deck .bd-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  margin-top: 14px;
  border: 0;
  border-radius: 3px;
  background: #0a0b04;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.s-buy-deck .bd-cta:hover {
  opacity: 0.9;
}
html.dark .s-buy-deck .bd-cta {
  background: var(--accent);
  color: #0a0b04;
}

/* frame footer */
.s-buy-deck .bd-framefoot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--b-line);
}
.s-buy-deck .bd-foot-r {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--b-faint);
}
.s-buy-deck .bd-foot-r img {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.s-buy-deck .bd-foot-a {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--b-muted);
  transition: color 0.18s ease;
}
.s-buy-deck .bd-foot-a:hover {
  color: var(--b-ink);
}

/* ---- chart column ---- */
.s-buy-deck .bd-charthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.s-buy-deck .bd-chartrng {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 600;
  color: var(--b-faint);
  font-variant-numeric: tabular-nums;
}
.s-buy-deck .bd-chartbox {
  position: relative;
  width: 100%;
  height: 322px;
  border: 1px solid var(--b-line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--b-panel);
  touch-action: pan-y;
  cursor: crosshair;
}
.s-buy-deck .bd-chartbox svg {
  width: 100%;
  height: 100%;
  display: block;
}
.s-buy-deck .bd-csvg {
  position: absolute;
  inset: 0;
}
.s-buy-deck .bd-chart-line {
  fill: none;
  stroke: var(--b-ink);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  stroke-linecap: round;
}
html.dark .s-buy-deck .bd-chart-line {
  stroke: var(--accent);
}
.s-buy-deck .bd-chart-area {
  fill: rgba(206, 246, 6, 0.16);
}
.s-buy-deck .bd-chx {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--b-line2);
  display: none;
  pointer-events: none;
  z-index: 3;
}
.s-buy-deck .bd-chdot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--b-ink);
  border: 2px solid var(--b-panel);
  transform: translate(-50%, -50%);
  display: none;
  pointer-events: none;
  z-index: 4;
}
html.dark .s-buy-deck .bd-chdot {
  background: var(--accent);
}
.s-buy-deck .bd-chtip {
  position: absolute;
  background: #0a0b04;
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: 4px;
  transform: translate(-50%, -140%);
  white-space: nowrap;
  display: none;
  pointer-events: none;
  z-index: 6;
  font-variant-numeric: tabular-nums;
}
html.dark .s-buy-deck .bd-chtip {
  background: #f2f4e8;
  color: #0a0b04;
}
.s-buy-deck .bd-chtip b {
  font-weight: 600;
}
.s-buy-deck .bd-chaxis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--b-faint);
  padding: 8px 2px 0;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* facts */
.s-buy-deck .bd-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--b-line);
  border: 1px solid var(--b-line);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 22px;
}
.s-buy-deck .bd-fact {
  background: var(--b-bg);
  padding: 15px 17px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.s-buy-deck .bd-fv {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--b-ink);
  line-height: 1.3;
  word-break: break-word;
}

/* dark: give footer/relay chip a light plate so the mark stays visible */
html.dark .s-buy-deck .bd-foot-r img {
  background: #fff;
}

/* ---- tablet ---- */
@media (max-width: 980px) {
  .s-buy-deck .bd-deck {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }
  .s-buy-deck .bd-frame {
    max-width: 438px;
  }
}

/* ---- small ---- */
@media (max-width: 720px) {
  .s-buy-deck .bd-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .s-buy-deck .bd-cell {
    padding: 20px 20px 22px;
  }
  .s-buy-deck .bd-cell:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }
  .s-buy-deck .bd-cell:nth-child(n + 3) {
    border-top: 1px solid var(--b-line);
  }
  .s-buy-deck .bd-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .s-buy-deck .bd-wrap {
    padding: 0 20px;
  }
}

/* ---- real-swap additions: balances, MAX, quote details, slippage, status ---- */
.s-buy-deck .bd-cardhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.s-buy-deck .bd-bal {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--b-faint);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.s-buy-deck .bd-bal b {
  color: var(--b-muted);
  font-weight: 600;
}
.s-buy-deck .bd-max {
  border: 1px solid var(--b-line2);
  background: transparent;
  color: var(--b-muted);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.s-buy-deck .bd-max:hover {
  border-color: var(--accent);
  color: var(--b-ink);
}

.s-buy-deck .bd-quote {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--b-line);
  border-radius: 4px;
  background: var(--b-bg);
  display: grid;
  gap: 8px;
}
.s-buy-deck .bd-qrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 12px;
}
.s-buy-deck .bd-qrow > span:first-child {
  color: var(--b-faint);
}
.s-buy-deck .bd-qrow > span:last-child {
  color: var(--b-ink);
  font-weight: 500;
}
.s-buy-deck .bd-impact-mid { color: #b7791f; }
.s-buy-deck .bd-impact-hi { color: #c53030; }

.s-buy-deck .bd-slip {
  display: inline-flex;
  gap: 4px;
}
.s-buy-deck .bd-slipopt {
  border: 1px solid var(--b-line2);
  background: transparent;
  color: var(--b-muted);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.s-buy-deck .bd-slipopt.is-on {
  border-color: var(--accent);
  background: var(--accent);
  color: #0a0b04;
}

.s-buy-deck .bd-status {
  margin-top: 10px;
  font-family: var(--font-ui);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--b-muted);
  word-break: break-word;
}
.s-buy-deck .bd-status a {
  color: var(--b-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.s-buy-deck .bd-status-err { color: #c53030; }
.s-buy-deck .bd-status-ok { color: #2f855a; }
html.dark .s-buy-deck .bd-status-ok { color: #9ae6b4; }
html.dark .s-buy-deck .bd-status-err { color: #feb2b2; }
html.dark .s-buy-deck .bd-impact-mid { color: #f6e05e; }
html.dark .s-buy-deck .bd-impact-hi { color: #feb2b2; }

.s-buy-deck .bd-cta:disabled {
  opacity: 0.5;
  cursor: default;
}

/* the footer "Add network" is now a button; keep it visually identical to the old link */
.s-buy-deck button.bd-foot-a {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.s-buy-deck .bd-framefoot .bd-foot-a { white-space: nowrap; }
