:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-card-hover: rgba(30, 37, 46, 0.9);
  --bg-input: #161b22;
  --border-color: rgba(48, 54, 61, 0.6);
  --text-primary: #e6edf3;
  --text-secondary: rgba(230, 237, 243, 0.7);
  --text-muted: rgba(139, 148, 158, 0.8);
  --accent-green: #10b981;
  --accent-cyan: #06b6d4;
  --accent-red: #ef4444;
  --glow-green: rgba(16, 185, 129, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background: #0d1117 !important;
  background-color: #0d1117 !important;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #0d1117 !important;
  background-color: #0d1117 !important;
  color: var(--text-primary, #e6edf3);
  min-height: 100vh;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

.header {
  display: flex;
  align-items: center;
  padding: 1rem;
  position: sticky;
  top: 0;
  background: #0d1117 !important;
  background-color: #0d1117 !important;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

.back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.back-btn:hover {
  border-color: var(--accent-green);
}

.header-title {
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  margin-right: 40px;
}

.convert-container {
  padding: 1.5rem 1rem;
}

/* Token Select Box */
.token-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.token-box-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.token-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.token-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(13, 17, 23, 0.9) !important;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  color: var(--text-primary);
  transition: background 0.2s;
}

.token-selector:hover {
  background: rgba(255, 255, 255, 0.12);
}

.token-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
}

.token-icon.usdt {
  background: linear-gradient(135deg, #26a17b, #1a7a5c);
}

.token-icon.usdc {
  background: linear-gradient(135deg, #2775ca, #1a5a9e);
}

.token-icon.btc {
  background: linear-gradient(135deg, #f7931a, #c77800);
}

.token-icon.eth {
  background: linear-gradient(135deg, #627eea, #3c3c3d);
}

.token-icon.bnb {
  background: linear-gradient(135deg, #f3ba2f, #c99a00);
}

.token-icon.sol {
  background: linear-gradient(135deg, #9945ff, #14f195);
}

.token-icon.xrp {
  background: linear-gradient(135deg, #23292f, #000000);
}

.token-icon.ada {
  background: linear-gradient(135deg, #0033ad, #001a57);
}

.token-icon.doge {
  background: linear-gradient(135deg, #c2a633, #9a8429);
}

.token-icon.avax {
  background: linear-gradient(135deg, #e84142, #b5302f);
}

.token-icon.dot {
  background: linear-gradient(135deg, #e6007a, #a30055);
}

.token-icon.matic {
  background: linear-gradient(135deg, #8247e5, #5d2fb5);
}

.token-icon.link {
  background: linear-gradient(135deg, #2a5ada, #1e3f9e);
}

.token-icon.ltc {
  background: linear-gradient(135deg, #bfbbbb, #838383);
}

.token-icon.shib {
  background: linear-gradient(135deg, #ffa409, #cc8307);
}

.token-icon.atom {
  background: linear-gradient(135deg, #2e3148, #1b1e2e);
}

.token-icon.uni {
  background: linear-gradient(135deg, #ff007a, #bd005a);
}

.token-icon.xlm {
  background: linear-gradient(135deg, #14b6e7, #0e8bb2);
}

.token-icon.trx {
  background: linear-gradient(135deg, #ef0027, #b8001e);
}

.token-icon.ton {
  background: linear-gradient(135deg, #0098ea, #0070aa);
}

.token-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.token-selector svg {
  color: var(--text-secondary);
}

.amount-input {
  flex: 1;
  text-align: right;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
  outline: none;
  min-width: 0;
}

.amount-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.balance-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.balance-value {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.max-btn {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.5rem;
}

.max-btn:hover {
  background: rgba(245, 158, 11, 0.25);
}

/* Swap Button */
.swap-btn-container {
  display: flex;
  justify-content: center;
  margin: -0.75rem 0;
  position: relative;
  z-index: 2;
}

.swap-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-green);
  border: 4px solid var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s, background 0.2s;
}

.swap-btn:hover {
  background: #fbbf24;
}

.swap-btn.rotated {
  transform: rotate(180deg);
}

.swap-btn svg {
  color: #000;
}

/* Rate Info */
.rate-info {
  background: var(--bg-card);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-top: 1rem;
}

.rate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.rate-row:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

.rate-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.rate-value {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.rate-value.green {
  color: var(--accent-green);
}

/* Convert Button */
.convert-btn {
  width: 100%;
  padding: 1rem;
  margin-top: 1.5rem;
  background: var(--accent-green);
  border: none;
  border-radius: 0.75rem;
  color: #000;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.convert-btn:hover {
  background: #fbbf24;
}

.convert-btn:active {
  transform: scale(0.98);
}

.convert-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
}

/* Quick Amount Buttons */
.quick-amounts {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.quick-btn {
  flex: 1;
  padding: 0.5rem;
  background: rgba(13, 17, 23, 0.9) !important;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-btn:hover {
  background: rgba(13, 17, 23, 0.9) !important;
  color: var(--text-primary);
}

/* Token Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 1.5rem 1.5rem 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 70vh;
  transform: translateY(100%);
  transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
}

.token-list {
  padding: 0.5rem 0;
  max-height: 50vh;
  overflow-y: auto;
}

.token-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  transition: background 0.2s;
}

.token-item:hover {
  background: rgba(13, 17, 23, 0.9) !important;
}

.token-item.selected {
  background: rgba(245, 158, 11, 0.1);
}

.token-item-info {
  flex: 1;
}

.token-item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.token-item-full {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.token-item-balance {
  text-align: right;
}

.token-item-amount {
  font-size: 0.9rem;
  font-weight: 500;
}

.token-item-usd {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* History Section */
.history-section {
  margin-top: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.view-all {
  font-size: 0.8rem;
  color: var(--accent-orange);
  text-decoration: none;
}

.history-list {
  background: var(--bg-card);
  border-radius: 0.75rem;
  overflow: hidden;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.history-item:last-child {
  border-bottom: none;
}

.history-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-green);
}

.history-info {
  flex: 1;
}

.history-pair {
  font-weight: 500;
  font-size: 0.9rem;
}

.history-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.history-amounts {
  text-align: right;
}

.history-from {
  font-size: 0.85rem;
  color: var(--accent-red);
}

.history-to {
  font-size: 0.85rem;
  color: var(--accent-green);
}

/* Toast notification */
.toast-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.toast-overlay.active {
  opacity: 1;
  visibility: visible;
}

.toast-card {
  background: #1a1a1a;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 20px;
  padding: 2rem 1.8rem;
  text-align: center;
  max-width: 320px;
  width: 90%;
  transform: scale(0.85) translateY(20px);
  transition: transform 0.35s cubic-bezier(.21, 1.02, .73, 1);
}

.toast-overlay.active .toast-card {
  transform: scale(1) translateY(0);
}

.toast-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-icon svg {
  width: 36px;
  height: 36px;
  color: #10b981;
}

.toast-icon .check-path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: drawCheck 0.4s 0.3s forwards ease-out;
}

@keyframes drawCheck {
  to {
    stroke-dashoffset: 0;
  }
}

.toast-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.4rem;
}

.toast-detail {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
  margin-bottom: 1.2rem;
}

.toast-detail strong {
  color: #10b981;
  font-weight: 600;
}

.toast-close-btn {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.toast-close-btn:active {
  opacity: 0.8;
}

.inline-style-f2892a2e8a {
  display: none;
}

.inline-style-d1fecfc87d {
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.inline-style-b0c8d47f06 {
  z-index: 10000;
}

.inline-style-a55bbea430 {
  max-height: 60vh;
  overflow-y: auto;
  border-radius: 0;
}