:root {
  --bg: #050914;
  --grid: rgba(117, 132, 188, 0.08);
  --panel: rgba(20, 25, 46, 0.9);
  --panel-edge: rgba(84, 97, 150, 0.18);
  --field: rgba(10, 14, 29, 0.96);
  --field-edge: rgba(81, 95, 148, 0.22);
  --field-focus: rgba(130, 95, 255, 0.34);
  --text: #f5f7ff;
  --muted: #9399b6;
  --muted-soft: #6e7390;
  --accent-soft: #d1cbff;
  --shadow: 0 32px 88px rgba(3, 7, 18, 0.56);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 50% 14%, rgba(95, 52, 219, 0.15), transparent 32%), var(--bg);
}

button,
input {
  font: inherit;
}

.page-grid {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}

.page-glow {
  position: fixed;
  left: 50%;
  width: 760px;
  height: 760px;
  transform: translateX(-50%);
  border-radius: 50%;
  filter: blur(96px);
  pointer-events: none;
}

.page-glow-top {
  top: 8%;
  background: radial-gradient(circle, rgba(118, 73, 255, 0.22), transparent 62%);
}

.page-glow-bottom {
  bottom: -22%;
  background: radial-gradient(circle, rgba(226, 0, 255, 0.12), transparent 62%);
}

.viewport-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.download-card {
  width: min(100%, 760px);
  padding: 30px 30px 28px;
  border-radius: 26px;
  border: 1px solid var(--panel-edge);
  background:
    linear-gradient(180deg, rgba(23, 29, 54, 0.94), rgba(18, 23, 42, 0.9)),
    var(--panel);
  box-shadow: var(--shadow);
  animation: card-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-title {
  display: block;
  font-size: 14px;
  color: var(--text);
  font-weight: 700;
}

.card-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(83, 90, 124, 0.4);
  color: #a3a9c5;
  font-size: 10px;
  font-weight: 700;
}

.search-field,
.token-input-shell,
.custom-select-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  border-radius: 18px;
  border: 1px solid var(--field-edge);
  background: var(--field);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-field {
  padding: 0 18px;
}

.search-field:focus-within,
.token-input-shell:focus-within,
.custom-select-trigger:focus-visible,
.custom-select.is-open .custom-select-trigger {
  border-color: var(--field-focus);
  box-shadow: 0 0 0 4px rgba(107, 75, 255, 0.12);
}

.search-icon,
.token-icon,
.action-icon {
  width: 18px;
  height: 18px;
  color: #7880a7;
  flex: 0 0 auto;
}

.search-icon svg,
.token-icon svg,
.action-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-field input,
.token-input-shell input {
  flex: 1 1 auto;
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 14px;
}

.search-field input::placeholder,
.token-input-shell input::placeholder {
  color: #616885;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.field-block {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.custom-select {
  position: relative;
}

.custom-select-trigger {
  padding: 0 18px;
  justify-content: space-between;
}

.custom-select-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.custom-select-value {
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(92, 69, 187, 0.34);
  color: var(--accent-soft);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.custom-select-arrow {
  width: 12px;
  height: 12px;
  margin-left: 12px;
  flex: 0 0 auto;
  border-right: 1.5px solid #8b92b2;
  border-bottom: 1.5px solid #8b92b2;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
}

.custom-select.is-open .custom-select-arrow {
  transform: rotate(-135deg) translateY(2px);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(88, 103, 164, 0.28);
  background: linear-gradient(180deg, rgba(18, 23, 42, 0.98), rgba(13, 17, 32, 0.98));
  box-shadow: 0 24px 44px rgba(3, 7, 18, 0.42);
}

.custom-select-option {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  background: rgba(98, 72, 255, 0.14);
  border-color: rgba(111, 88, 255, 0.24);
  outline: none;
}

.custom-select-option.is-active {
  background: rgba(112, 73, 255, 0.18);
  border-color: rgba(123, 95, 255, 0.22);
}

.custom-select-option + .custom-select-option {
  margin-top: 6px;
}

.token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 12px;
}

.token-input-shell {
  padding: 0 16px;
  background: linear-gradient(90deg, rgba(52, 42, 98, 0.76), rgba(73, 43, 96, 0.78));
}

.token-button {
  min-height: 56px;
  border: 1px solid rgba(105, 91, 170, 0.24);
  border-radius: 16px;
  background: rgba(66, 48, 112, 0.84);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.token-button:hover {
  transform: translateY(-1px);
  background: rgba(80, 56, 132, 0.94);
}

.primary-action {
  margin-top: 24px;
  width: 100%;
  min-height: 62px;
  border: 0;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(90deg, #5d44ff 0%, #8c25ff 48%, #ea00ff 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 18px 40px rgba(128, 36, 255, 0.32);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 48px rgba(128, 36, 255, 0.42);
  filter: saturate(1.08);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.progress-panel {
  margin-top: 16px;
  padding: 14px 2px 0;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-phase,
.progress-percent {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.progress-track {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5d44ff 0%, #8c25ff 48%, #ea00ff 100%);
  transition: width 0.25s ease;
}

.action-note {
  margin: 10px 2px 0;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.action-note.is-error { color: #ff9dc4; }
.action-note.is-success { color: #9fe0b3; }

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 900px) {
  .download-card {
    width: min(100%, 620px);
  }
}

@media (max-width: 640px) {
  body {
    overflow: auto;
  }

  .viewport-shell {
    padding: 18px;
  }

  .download-card {
    width: 100%;
    border-radius: 22px;
    padding: 22px 18px 18px;
  }

  .card-head {
    align-items: center;
  }

  .card-subtitle {
    display: none;
  }

  .split-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .token-row {
    grid-template-columns: minmax(0, 1fr) 86px;
  }

  .search-field,
  .token-input-shell,
  .custom-select-trigger {
    min-height: 50px;
  }

  .token-button {
    min-height: 50px;
  }

  .primary-action {
    min-height: 54px;
    font-size: 15px;
  }
}
