:root {
  --sps-exchange-bg: #03060a;
  --sps-exchange-line: rgba(190, 204, 223, 0.13);
  --sps-exchange-muted: rgba(202, 212, 228, 0.62);
}

.sundex-card-story + .sps-trade-stage.sps-exchange-stage {
  margin-top: -1px;
}

.sps-trade-stage.sps-exchange-stage {
  min-height: 0;
  overflow: hidden;
  background: var(--sps-exchange-bg);
}

.sps-trade-stage.sps-exchange-stage::before {
  z-index: 1;
  background:
    linear-gradient(180deg, #03060a 0, transparent 12%, transparent 88%, #03060a 100%);
}

.sps-exchange-shell {
  position: relative;
  display: grid;
  width: min(100%, 1920px);
  height: clamp(590px, 45vw, 680px);
  grid-template-columns: 39% 61%;
  margin: 0 auto;
  overflow: hidden;
  background: #03060a;
}

.sps-exchange-visual {
  position: absolute;
  z-index: 0;
  inset: 0 61% 0 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

.sps-exchange-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 32% center;
  filter: saturate(0.3) brightness(0.5) contrast(1.2);
  transform: scale(1.02);
}

.sps-exchange-visual span {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 6, 10, 0.46) 0%, rgba(3, 6, 10, 0.12) 48%, #03060a 100%),
    linear-gradient(180deg, #03060a 0%, transparent 22%, transparent 76%, #03060a 100%);
}

.sps-exchange-copy {
  position: relative;
  z-index: 2;
  display: flex;
  width: min(100%, 500px);
  align-self: center;
  flex-direction: column;
  align-items: flex-start;
  margin-left: clamp(42px, 5vw, 92px);
}

.sps-section .sps-exchange-copy h2 {
  max-width: 7.6ch;
  margin: 0;
  font-size: clamp(4.35rem, 5.15vw, 6.25rem);
  font-weight: 540;
  letter-spacing: -0.052em;
  line-height: 0.96;
  text-wrap: balance;
}

.sps-exchange-copy p {
  max-width: 21rem;
  margin: 26px 0 0;
  color: rgba(213, 221, 233, 0.72);
  font-size: 1.08rem;
  line-height: 1.46;
}

.sps-exchange-copy .sps-button {
  min-height: 46px;
  margin-top: 26px;
  padding: 0 26px;
  border: 1px solid rgba(218, 227, 239, 0.28);
  border-radius: 3px;
  background: rgba(3, 6, 10, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sps-exchange-panel {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(100%, 1040px);
  align-self: center;
  justify-self: center;
  padding: 0 clamp(40px, 3.2vw, 64px);
  border: 0;
  border-radius: 0;
  color: var(--sps-ink);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sps-exchange-panel::after {
  content: none;
}

.sps-exchange-row {
  display: grid;
  min-width: 0;
  min-height: 154px;
  grid-template-columns: minmax(300px, 0.88fr) minmax(330px, 1.12fr);
  align-items: center;
  gap: clamp(34px, 3.4vw, 62px);
}

.sps-exchange-asset {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: 72px minmax(0, auto) auto 18px;
  align-items: center;
  gap: 13px;
  padding: 10px 0;
}

.sps-exchange-mark {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: #10151d;
  background: #aeb8c5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-size: 1rem;
  font-weight: 650;
}

.sps-exchange-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sps-exchange-mark-fiat {
  width: 72px;
  height: 72px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  color: rgba(230, 235, 243, 0.78);
  background: none;
  box-shadow: none;
  font-size: clamp(3rem, 3.4vw, 4rem);
  font-weight: 470;
  letter-spacing: -0.055em;
}

.sps-exchange-name {
  overflow: hidden;
  color: #f2f5f9;
  font-size: 1.14rem;
  font-weight: 590;
  letter-spacing: -0.018em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sps-exchange-code {
  color: rgba(198, 208, 223, 0.54);
  font-size: 0.82rem;
  font-weight: 560;
  white-space: nowrap;
}

.sps-exchange-chevron {
  color: rgba(217, 227, 241, 0.56);
  font-size: 1rem;
  transform: translateY(-2px);
}

.sps-exchange-asset select {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.sps-exchange-asset:focus-within {
  outline: 0;
  box-shadow: inset 0 -1px 0 rgba(211, 224, 243, 0.82);
}

.sps-exchange-amount {
  display: flex;
  min-width: 0;
  justify-content: flex-end;
}

.sps-exchange-amount input,
.sps-exchange-output {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 0;
  color: #f4f6fa;
  background: transparent;
  font: inherit;
  font-size: clamp(4rem, 5.15vw, 6rem);
  font-weight: 430;
  letter-spacing: -0.062em;
  line-height: 0.92;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sps-exchange-amount input {
  padding: 8px 0;
  outline: 0;
  caret-color: #d8e6f9;
  appearance: textfield;
  -moz-appearance: textfield;
}

.sps-exchange-amount input::-webkit-outer-spin-button,
.sps-exchange-amount input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.sps-exchange-amount:focus-within {
  box-shadow: inset 0 -1px 0 rgba(213, 227, 246, 0.68);
}

.sps-exchange-output {
  display: block;
  align-self: center;
  font-variant-numeric: tabular-nums;
}

.sps-exchange-output[data-number-length="long"] {
  font-size: clamp(3.65rem, 4.45vw, 5.15rem);
}

.sps-exchange-output[data-number-length="extended"] {
  font-size: clamp(3rem, 3.75vw, 4.5rem);
}

.sps-exchange-divider {
  position: relative;
  height: 1px;
  margin: 0;
  background: linear-gradient(90deg, transparent 0, var(--sps-exchange-line) 14%, var(--sps-exchange-line) 86%, transparent 100%);
}

.sps-exchange-swap {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(231, 237, 246, 0.48);
  border-radius: 50%;
  color: #111721;
  background:
    radial-gradient(circle at 34% 22%, #ffffff 0%, transparent 33%),
    linear-gradient(145deg, #e4e8ee, #818b98 64%, #d8dee7);
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -2px 5px rgba(25, 32, 43, 0.3),
    0 12px 28px rgba(0, 0, 0, 0.38);
  font: inherit;
  font-size: 1.38rem;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: filter 160ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
  -webkit-tap-highlight-color: transparent;
}

.sps-exchange-swap:focus-visible,
.sps-exchange-submit:focus-visible {
  outline: 2px solid rgba(208, 226, 250, 0.98);
  outline-offset: 4px;
}

.sps-exchange-meta {
  display: flex;
  align-items: center;
  gap: 34px;
  margin-top: 30px;
  color: rgba(194, 207, 225, 0.58);
  font-size: 0.82rem;
}

.sps-exchange-meta span + span {
  padding-left: 34px;
  border-left: 1px solid var(--sps-exchange-line);
}

.sps-exchange-meta strong {
  color: rgba(230, 236, 245, 0.84);
  font-weight: 560;
}

.sps-exchange-submit {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  padding: 0 28px;
  border: 1px solid rgba(246, 249, 253, 0.72);
  border-radius: 3px;
  color: #10151c;
  background: linear-gradient(180deg, #f0f3f7, #aeb8c5);
  box-shadow:
    inset 0 1px 0 #ffffff,
    inset 0 -2px 5px rgba(45, 55, 69, 0.25);
  font: inherit;
  font-size: 1rem;
  font-weight: 620;
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
  -webkit-tap-highlight-color: transparent;
}

.sps-exchange-note {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.sps-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

@media (hover: hover) and (pointer: fine) {
  .sps-exchange-asset:hover .sps-exchange-chevron {
    color: rgba(242, 247, 252, 0.92);
  }

  .sps-exchange-swap:hover {
    filter: brightness(1.08);
  }

  .sps-exchange-swap:active {
    transform: translate(-50%, -50%) scale(0.96);
  }

  .sps-exchange-submit:hover {
    filter: brightness(1.05);
  }

  .sps-exchange-submit:active {
    transform: scale(0.98);
  }
}

@media (max-width: 1040px) {
  .sps-exchange-shell {
    grid-template-columns: 37% 63%;
  }

  .sps-exchange-visual {
    right: 63%;
  }

  .sps-exchange-panel {
    padding-inline: 34px;
  }

  .sps-exchange-row {
    grid-template-columns: minmax(220px, 1fr) minmax(190px, 0.86fr);
    gap: 18px;
  }

  .sps-exchange-asset {
    grid-template-columns: 54px minmax(0, auto) auto 16px;
  }

  .sps-exchange-mark,
  .sps-exchange-mark-fiat {
    width: 54px;
    height: 54px;
  }

  .sps-exchange-amount input,
  .sps-exchange-output {
    font-size: clamp(3rem, 5.2vw, 4.2rem);
  }
}

@media (max-width: 800px) {
  .sps-exchange-shell {
    height: auto;
    grid-template-columns: 1fr;
  }

  .sps-exchange-visual {
    inset: 0 0 auto;
    height: 390px;
  }

  .sps-exchange-visual img {
    object-position: 32% center;
  }

  .sps-exchange-visual span {
    background:
      linear-gradient(180deg, rgba(3, 6, 10, 0.22), rgba(3, 6, 10, 0.18) 48%, #03060a 100%),
      linear-gradient(90deg, rgba(3, 6, 10, 0.38), rgba(3, 6, 10, 0.2));
  }

  .sps-exchange-copy {
    min-height: 390px;
    align-self: auto;
    justify-content: center;
    margin: 0;
    padding: 64px 28px 48px;
  }

  .sps-section .sps-exchange-copy h2 {
    font-size: clamp(3.6rem, 12vw, 5rem);
  }

  .sps-exchange-panel {
    width: 100%;
    padding: 40px 28px 70px;
  }
}

@media (max-width: 560px) {
  .sps-exchange-visual,
  .sps-exchange-copy {
    min-height: 340px;
    height: 340px;
  }

  .sps-exchange-copy {
    padding-inline: 20px;
  }

  .sps-section .sps-exchange-copy h2 {
    font-size: clamp(3.15rem, 16vw, 4.35rem);
  }

  .sps-exchange-copy p {
    margin-top: 18px;
    font-size: 0.94rem;
  }

  .sps-exchange-copy .sps-button {
    margin-top: 18px;
  }

  .sps-exchange-panel {
    padding: 32px 20px 58px;
  }

  .sps-exchange-row {
    min-height: 148px;
    grid-template-columns: 1fr;
    align-content: center;
    gap: 10px;
  }

  .sps-exchange-asset {
    grid-template-columns: 48px minmax(0, auto) auto 16px;
  }

  .sps-exchange-mark,
  .sps-exchange-mark-fiat {
    width: 48px;
    height: 48px;
  }

  .sps-exchange-mark-fiat {
    font-size: 2.5rem;
  }

  .sps-exchange-amount,
  .sps-exchange-output {
    justify-content: flex-start;
    text-align: left;
  }

  .sps-exchange-amount input,
  .sps-exchange-output {
    font-size: clamp(3rem, 14vw, 4rem);
    text-align: left;
  }

  .sps-exchange-swap {
    width: 50px;
    height: 50px;
  }

  .sps-exchange-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-top: 24px;
  }

  .sps-exchange-meta span + span {
    padding-left: 0;
    border-left: 0;
  }

  .sps-exchange-submit {
    min-height: 56px;
    margin-top: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sps-exchange-swap,
  .sps-exchange-submit {
    transition-duration: 0.01ms !important;
  }
}
