/* PredicXion 闪兑 */

.swap-main {
  overflow: hidden;
}

.swap-container {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 0 20px;
}

.swap-section {
  padding: 64px 0;
}

.swap-section__title {
  margin-bottom: 12px;
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--text-strong);
}

.swap-section__subtitle {
  margin-bottom: 36px;
  font-size: 15px;
  text-align: center;
  color: var(--text-secondary);
}

/* Hero */
.swap-hero {
  padding: 32px 0 56px;
}

@media (min-width: 768px) {
  .swap-hero {
    padding-top: 56px;
  }
}

.swap-hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: start;
}

@media (min-width: 960px) {
  .swap-hero__grid {
    grid-template-columns: 1fr 440px;
    gap: 48px;
    align-items: center;
  }
}

.swap-hero__title {
  margin-bottom: 16px;
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-strong);
}

.swap-hero__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 0;
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
}

.swap-hero__tags span:not(:last-child)::after {
  content: "|";
  margin: 0 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.swap-hero__desc {
  max-width: 520px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* Swap card */
.swap-card {
  position: relative;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.swap-field {
  padding: 14px 16px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
}

.swap-field__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.swap-field__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}

.swap-field__avail-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.swap-field__avail {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swap-field__eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.swap-field__eye:hover {
  color: var(--text-secondary);
}

.swap-field__body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.swap-coin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 6px 10px 6px 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
}

.swap-coin--select {
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.swap-coin--select:hover {
  border-color: var(--text-muted);
}

.swap-coin__chevron {
  width: 12px;
  height: 12px;
  color: var(--text-muted);
}

.swap-coin__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border-radius: 50%;
}

.swap-coin__icon--pdusd { background: linear-gradient(135deg, #14b8a6, #2a9d6a); }
.swap-coin__icon--usdt { background: linear-gradient(135deg, #26a17b, #1a7a5c); }
.swap-coin__icon--usdc { background: linear-gradient(135deg, #2775ca, #1e5aa8); }
.swap-coin__icon--btc { background: linear-gradient(135deg, #f7931a, #e8820e); }
.swap-coin__icon--eth { background: linear-gradient(135deg, #627eea, #4a5fc7); }
.swap-coin__icon--bnb { background: linear-gradient(135deg, #f3ba2f, #d4a017); }
.swap-coin__icon--sol { background: linear-gradient(135deg, #9945ff, #14f195); }
.swap-coin__icon--trx { background: linear-gradient(135deg, #ff0013, #c40010); }
.swap-coin__icon--xrp { background: linear-gradient(135deg, #23292f, #000); }
.swap-coin__icon--doge { background: linear-gradient(135deg, #c2a633, #a88b20); }
.swap-coin__icon--ltc { background: linear-gradient(135deg, #345d9d, #264a7a); }
.swap-coin__icon--pepe { background: linear-gradient(135deg, #3d9970, #2d7a56); }
.swap-coin__icon--ton { background: linear-gradient(135deg, #0098ea, #0077b8); }
.swap-coin__icon--pol { background: linear-gradient(135deg, #8247e5, #6b3bc4); }
.swap-coin__icon--pdx { background: linear-gradient(135deg, #14b8a6, #18181b); }

.swap-field__amount {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.swap-field__input,
.swap-field__output {
  width: 100%;
  padding: 0;
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 600;
  color: var(--text-strong);
  background: transparent;
  border: none;
  outline: none;
  text-align: right;
}

.swap-field__input::placeholder {
  color: var(--text-placeholder);
  font-weight: 500;
}

.swap-field__output.is-placeholder {
  color: var(--text-placeholder);
  font-weight: 500;
  font-size: clamp(18px, 3.5vw, 24px);
}

.swap-field__max {
  padding: 2px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
}

.swap-field__max:hover {
  text-decoration: underline;
}

.swap-divider {
  display: flex;
  justify-content: center;
  margin: 10px 0;
  position: relative;
  z-index: 1;
}

.swap-divider__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text-strong);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}

.swap-divider__btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.swap-divider__btn:active {
  transform: scale(0.96);
}

.swap-rate {
  margin: 16px 0 20px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.swap-submit-wrap {
  position: relative;
}

.swap-submit__badge {
  position: absolute;
  top: -10px;
  right: 12px;
  z-index: 1;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
  line-height: 1.2;
}

.swap-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-on);
  background: var(--brand);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.swap-submit:hover:not(:disabled) {
  background: var(--brand-hover);
}

.swap-submit:disabled {
  color: var(--text-muted);
  background: var(--bg-muted);
  cursor: not-allowed;
}

/* Coin picker */
.swap-picker {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.swap-picker[hidden] {
  display: none;
}

.swap-picker__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.swap-picker__panel {
  position: relative;
  width: min(100%, 400px);
  max-height: min(80vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.swap-picker__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
}

.swap-picker__head h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
}

.swap-picker__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.swap-picker__close:hover {
  color: var(--text-strong);
  background: var(--bg-muted);
}

.swap-picker__search {
  padding: 0 20px 12px;
}

.swap-picker__search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  font-size: 14px;
  color: var(--text-strong);
  background: var(--bg-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
}

.swap-picker__search input:focus {
  border-color: var(--border-default);
  background: var(--bg-card);
}

.swap-picker__search-wrap {
  position: relative;
}

.swap-picker__search-wrap i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.swap-picker__list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
  list-style: none;
}

.swap-picker__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}

.swap-picker__item:hover,
.swap-picker__item.is-active {
  background: var(--bg-muted);
}

.swap-picker__item .swap-coin__icon {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.swap-picker__meta {
  flex: 1;
  min-width: 0;
}

.swap-picker__symbol {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.3;
}

.swap-picker__name {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

.swap-picker__balance {
  flex-shrink: 0;
  text-align: right;
}

.swap-picker__balance-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.3;
}

.swap-picker__balance-usd {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
}

.swap-picker__empty {
  padding: 32px 16px;
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

/* Coins grid */
.swap-coins {
  background: var(--bg-muted);
}

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

@media (min-width: 640px) {
  .swap-coins__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 960px) {
  .swap-coins__grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.swap-coins__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.swap-coins__item:hover {
  border-color: rgba(20, 184, 166, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.swap-coins__icon {
  width: 40px;
  height: 40px;
  font-size: 13px;
}

.swap-coins__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
}

/* 极简居中布局 */
.swap-main--simple {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--header-height) + 96px) 16px 64px;
  min-height: 100vh;
  background: var(--bg-base);
}
.swap-simple-wrap {
  width: 100%;
  max-width: 460px;
}
.swap-simple-wrap .swap-card {
  width: 100%;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-soft);
  padding: 24px;
  background: var(--bg-card);
}
/* hide rate label when empty */
#swap-rate:empty { display: none; }
