@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Syne:wght@400;600;700;800&display=swap');

/* === RESET & BASE === */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
}

:root {
  --bg:        #080a0e;
  --surface:   #0d1117;
  --surface2:  #111620;
  --border:    rgba(255,255,255,0.06);
  --border2:   rgba(255,255,255,0.10);
  --text:      #e8edf5;
  --text-dim:  #5a6478;
  --text-mid:  #8b95aa;
  --accent:    #7fffb2;
  --accent2:   #00e5ff;
  --accent-glow: rgba(127,255,178,0.15);
  --red:       #ff4d6d;
  --mono:      'Space Mono', monospace;
  --sans:      'Syne', sans-serif;
  --radius:    10px;
  --radius-lg: 16px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 40px 20px 80px;
  -webkit-font-smoothing: antialiased;
  /* subtle noise grain overlay */
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(0,229,255,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(127,255,178,0.04) 0%, transparent 60%);
}

main {
  display: flex;
  justify-content: center;
}

/* === CONTAINER === */
.mix-container {
  width: 100%;
  max-width: 960px;
}

/* === HEADER === */
.mix-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 48px;
  gap: 16px;
}

.mix-logo {
  width: 52px;
  height: 52px;
  display: block;
}

.mix-title {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mid);
  max-width: 500px;
  line-height: 1.6;
}

/* badge above title */
.mix-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(127,255,178,0.08);
  border: 1px solid rgba(127,255,178,0.2);
  border-radius: 100px;
  padding: 5px 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.mix-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.7); }
}

/* === FORM === */
.mix-form { width: 100%; }

/* === EXCHANGE PANEL === */
.exchange-panel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 0;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  overflow: visible;
  position: relative;
}

.panel {
  display: flex;
  flex-direction: column;
  padding: 24px;
  min-width: 0;
}

.from-panel { border-right: 1px solid var(--border); }

/* === PANEL LABEL === */
.panel-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

/* === AMOUNT INPUT === */
.panel-header {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
}

.from-panel .panel-header input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  caret-color: var(--accent);
  letter-spacing: -0.02em;
}

.from-panel .panel-header input::placeholder {
  color: var(--text-dim);
}

.from-panel .panel-header input.error {
  color: var(--red);
}

/* === RECEIVE AMOUNT === */
.to-panel .panel-header .receive-big {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  transition: color 0.3s;
}

/* === CUSTOM SELECT === */
.panel-select { position: relative; }

.custom-select {
  position: relative;
  width: 100%;
  z-index: 100;
}

.select-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}

.select-trigger:hover {
  border-color: rgba(255,255,255,0.18);
  background: #161c28;
}

.custom-select.active .select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.select-logo { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }
.select-value { flex: 1; font-size: 13px; font-weight: 600; letter-spacing: 0.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.arrow {
  color: var(--text-dim);
  font-size: 11px;
  transition: transform 0.25s;
}
.custom-select.active .arrow { transform: rotate(180deg); }

/* === DROPDOWN === */
.options {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: #0d1117;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  max-height: 280px;
  overflow-y: auto;
  display: none;
  z-index: 9999;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7);
}

.options::-webkit-scrollbar { width: 4px; }
.options::-webkit-scrollbar-track { background: transparent; }
.options::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.search-input {
  position: sticky; top: 0; z-index: 2;
  width: 100%; height: 44px;
  padding: 0 14px;
  background: #0d1117;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
}

.search-input::placeholder { color: var(--text-dim); }

.opt-group {
  padding: 10px 14px 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
  position: sticky;
  top: 44px;
  background: #0d1117;
  z-index: 1;
}

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.option:last-child { border-bottom: none; }
.option:hover { background: rgba(255,255,255,0.04); }
.option.selected { background: rgba(127,255,178,0.05); color: var(--accent); }
.option img { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; }
.option span { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === SWAP BUTTON === */
.mix-swap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text-mid);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex-shrink: 0;
  transition: all 0.25s;
  position: relative;
  z-index: 10;
  margin: 0 -22px;
}

.mix-swap:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  transform: rotate(180deg);
  box-shadow: 0 0 24px var(--accent-glow);
}

/* === WALLET INPUT === */
.wallet-section {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}

.mix-form label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.mix-form input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  letter-spacing: 0.02em;
}

.mix-form input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.mix-form input[type="text"]::placeholder { color: var(--text-dim); }

/* === VALIDATION === */
.wallet-error { color: var(--red); font-size: 12px; margin-top: 8px; display: none; font-family: var(--mono); }
.wallet-input.error { border-color: var(--red) !important; }
.wallet-validation-status { display: inline-block; margin-left: 6px; font-size: 12px; }
.wallet-validation-status.valid  { color: var(--accent); }
.wallet-validation-status.invalid{ color: var(--red); }
.amount-error { color: var(--red); font-size: 12px; margin-top: 6px; font-family: var(--mono); }

/* === SUBMIT === */
.mix-submit {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 32px rgba(127,255,178,0.2);
  margin-top: 4px;
}

.mix-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 48px rgba(127,255,178,0.35);
}

.mix-submit:active { transform: translateY(0); }

/* === FEATURES STRIP === */
.features-strip {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin: 28px 0 0;
  flex-wrap: wrap;
}

.feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.feature::before {
  content: '✓';
  color: var(--accent);
  font-size: 12px;
}

/* === SEO SECTION === */
.seo-section {
  max-width: 780px;
  margin: 56px auto 0;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-mid);
}

.seo-section h2 {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 10px;
  letter-spacing: 0.02em;
}

.seo-section h2:first-child { margin-top: 0; }

.seo-section p {
  font-size: 13px;
  line-height: 1.75;
  margin-bottom: 14px;
  color: var(--text-mid);
}

.seo-section ul, .seo-section ol {
  margin: 12px 0 14px 20px;
}

.seo-section li {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-mid);
  margin-bottom: 4px;
}

.seo-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.seo-section td {
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mid);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.seo-section strong { color: var(--text); }

/* === INFO BLOCK === */
.info-block {
  max-width: 780px;
  margin: 20px auto 0;
  padding: 24px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.info-block .label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.info-block .value a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

.info-block .value a:hover { opacity: 0.75; }

/* === LOADER === */
.loader {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  visibility: hidden;
  margin-left: 8px;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  body { padding: 24px 16px 60px; }

  .exchange-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .from-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .to-panel {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  .mix-swap {
    margin: 0 auto;
    position: relative;
    z-index: 20;
    /* pull up/down to sit between panels */
    transform: none;
    order: 2;
  }

  .from-panel { order: 1; }
  .to-panel   { order: 3; }

  .from-panel .panel-header input,
  .to-panel .panel-header .receive-big {
    font-size: 28px;
  }

  .features-strip { gap: 18px; }
  .seo-section, .info-block { padding: 24px 20px; }
}

@media (max-width: 480px) {
  .mix-title { font-size: 13px; }

  .panel { padding: 18px; }

  .from-panel .panel-header input,
  .to-panel .panel-header .receive-big {
    font-size: 24px;
  }

  .mix-submit { font-size: 14px; padding: 14px; }

  .features-strip { flex-direction: column; align-items: center; gap: 12px; }
}
