@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #1c1c1c;
  --surface: #232323;
  --surface-2: #2a2a2a;
  --surface-3: #333333;
  --surface-hover: #383838;
  --line: #3a3a3a;
  --text: #f2f2f2;
  --text-dim: #8a8a8a;
  --text-mute: #5c5c5c;
  --accent: #8b5cf6;
  --accent-soft: #2a1f3d;
  --accent-text: #ffffff;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 220ms;
  --dur-fast: 140ms;
}

[data-theme="light"] {
  --bg: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #ececec;
  --surface-3: #e0e0e0;
  --surface-hover: #d4d4d4;
  --line: #d0d0d0;
  --text: #1c1c1c;
  --text-dim: #6e6e6e;
  --text-mute: #a0a0a0;
  --accent-soft: #ede9fe;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur) var(--ease);
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition:
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    transform var(--dur-fast) var(--ease),
    opacity var(--dur) var(--ease);
}
button:active { transform: scale(0.97); }

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.icon-sm { width: 16px; height: 16px; }

/* ---------- Top right ---------- */

.top-right {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 20;
}

.wallet-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
}
.wallet-btn:hover { background-color: var(--surface-hover); }
.wallet-btn .icon { width: 16px; height: 16px; color: var(--text); }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background-color: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background-color: var(--surface-hover); }
.icon-btn .icon { color: var(--text); }

/* ---------- Stage ---------- */

.stage {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
}

.swap-wrap {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: rise 360ms var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.swap-top {
  display: flex;
  justify-content: flex-end;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px 9px 12px;
  border-radius: 999px;
}
.chip-btn:hover { background-color: var(--surface-hover); }
.chip-btn .icon { width: 15px; height: 15px; color: var(--text); }

/* ---------- Swap card ---------- */

.swap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--surface);
  border-radius: 24px;
  padding: 18px;
  transition: background-color var(--dur) var(--ease);
}

.swap-pair {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  background-color: var(--surface-2);
  border-radius: 18px;
  padding: 8px;
  transition: background-color var(--dur) var(--ease);
}

.coin-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background-color: transparent;
  padding: 14px;
  border-radius: 14px;
  width: 100%;
  text-align: left;
  color: var(--text);
}
.coin-row:hover { background-color: var(--surface-3); }

.coin-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--line);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}
.coin-icon[data-coin="BTC"]::before  { content: "₿"; }
.coin-icon[data-coin="ETH"]::before  { content: "Ξ"; }
.coin-icon[data-coin="SOL"]::before  { content: "◎"; }
.coin-icon[data-coin="USDC"]::before { content: "$"; }
.coin-icon[data-coin="USDT"]::before { content: "₮"; }
.coin-icon[data-coin="BNB"]::before  { content: "B"; }
.coin-icon[data-coin="XRP"]::before  { content: "✕"; }
.coin-icon[data-coin="ADA"]::before  { content: "₳"; }
.coin-icon[data-coin="DOGE"]::before { content: "Ð"; }
.coin-icon[data-coin="AVAX"]::before { content: "A"; }

.coin-icon[data-coin="BTC"]  { background-color: #f7931a; }
.coin-icon[data-coin="ETH"]  { background-color: #627eea; }
.coin-icon[data-coin="SOL"]  { background-color: #14f195; color: #0f0f0f; }
.coin-icon[data-coin="USDC"] { background-color: #2775ca; }
.coin-icon[data-coin="USDT"] { background-color: #26a17b; }
.coin-icon[data-coin="BNB"]  { background-color: #f3ba2f; color: #0f0f0f; }
.coin-icon[data-coin="XRP"]  { background-color: #23292f; }
.coin-icon[data-coin="ADA"]  { background-color: #0033ad; }
.coin-icon[data-coin="DOGE"] { background-color: #c2a633; color: #0f0f0f; }
.coin-icon[data-coin="AVAX"] { background-color: #e84142; }

.coin-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 1;
}

.coin-caption {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
}

.coin-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.quoting #amount-usd {
  color: transparent !important;
  background-color: var(--surface-3);
  border-radius: 6px;
  animation: skeleton-pulse 1.4s var(--ease) infinite;
  display: inline-block;
  width: 64px;
  height: 13px;
}

.swap-connector {
  width: 2px;
  height: 14px;
  background-color: var(--line);
  border-radius: 2px;
  margin-left: 33px;
}

.swap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--surface-2);
  border-radius: 18px;
  padding: 16px 20px;
  transition: background-color var(--dur) var(--ease);
}

.swap-row-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.swap-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.swap-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
}

.max-btn {
  background-color: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.max-btn:hover { filter: brightness(1.15); }

.swap-input {
  font-family: inherit;
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  text-align: left;
  letter-spacing: -0.01em;
}
.swap-input::placeholder {
  color: var(--text-mute);
  font-weight: 500;
}

.swap-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin-top: 2px;
}

.swap-button {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-text);
  background-color: var(--accent);
  border-radius: 18px;
  padding: 20px;
  letter-spacing: -0.005em;
}
.swap-button:hover { filter: brightness(1.06); }

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.modal.open { opacity: 1; pointer-events: auto; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 20px;
  background-color: var(--surface);
  border-radius: 24px;
  padding: 18px;
  transform: translateY(10px) scale(0.98);
  transition: transform var(--dur) var(--ease);
}
.modal.open .modal-card { transform: translateY(0) scale(1); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  background-color: transparent;
}
.modal-close:hover { background-color: var(--surface-2); }
.modal-close .icon { color: var(--text); }

.modal-body {
  background-color: var(--surface-2);
  border-radius: 16px;
  padding: 10px;
}

.modal-empty {
  padding: 36px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-icon {
  width: 40px;
  height: 40px;
  color: var(--text-mute);
}
.empty-icon svg { width: 100%; height: 100%; }

.placeholder-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ---------- Settings ---------- */

.settings-body {
  background-color: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background-color: var(--surface-2);
  transition: background-color var(--dur) var(--ease);
}

.setting-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

.segmented {
  display: inline-flex;
  background-color: var(--surface);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  background-color: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background-color: var(--accent);
  color: var(--accent-text);
}

/* Switch */
.switch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-track {
  width: 38px;
  height: 22px;
  background-color: var(--surface);
  border-radius: 999px;
  position: relative;
  transition: background-color var(--dur) var(--ease);
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--text-dim);
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.switch input:checked + .switch-track { background-color: var(--accent); }
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(16px);
  background-color: var(--accent-text);
}

/* ---------- Coin picker ---------- */

.coin-search-wrap {
  position: relative;
  margin: 0 0 10px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-mute);
}
.coin-search {
  font-family: inherit;
  width: 100%;
  background-color: var(--surface-2);
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 14px 12px 38px;
  border-radius: 14px;
  transition: background-color var(--dur) var(--ease);
}
.coin-search:focus { background-color: var(--surface-3); }
.coin-search::placeholder { color: var(--text-mute); }

.coin-list {
  list-style: none;
  background-color: var(--surface-2);
  border-radius: 16px;
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.coin-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease);
}
.coin-list-item:hover { background-color: var(--surface-3); }

.coin-list-item .coin-icon {
  width: 32px;
  height: 32px;
  font-size: 10px;
}

.coin-list-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.coin-list-symbol {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.coin-list-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
}

.coin-list-check {
  width: 16px;
  height: 16px;
  color: var(--accent);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.coin-list-item.active .coin-list-check { opacity: 1; }

/* ---------- Skeleton ---------- */

.skeleton {
  display: inline-block;
  background-color: var(--surface-3);
  border-radius: 6px;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
  animation: skeleton-pulse 1.4s var(--ease) infinite;
}
.skeleton.skeleton-circle { border-radius: 50%; }

.skeleton-text {
  height: 0.9em;
  width: 60px;
  vertical-align: middle;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

.is-loading .coin-icon { background-color: var(--surface-3) !important; color: transparent !important; animation: skeleton-pulse 1.4s var(--ease) infinite; }
.is-loading .coin-name,
.is-loading .swap-sub { color: transparent !important; background-color: var(--surface-3); border-radius: 6px; animation: skeleton-pulse 1.4s var(--ease) infinite; }
.is-loading .coin-name { display: inline-block; width: 56px; height: 17px; }
.is-loading .swap-sub  { display: inline-block; width: 64px; height: 13px; }

.coin-list-item.skeleton-item {
  pointer-events: none;
}
.coin-list-item.skeleton-item .coin-icon {
  animation: skeleton-pulse 1.4s var(--ease) infinite;
}
.coin-list-item.skeleton-item .coin-list-symbol,
.coin-list-item.skeleton-item .coin-list-name {
  color: transparent;
  background-color: var(--surface-3);
  border-radius: 6px;
  animation: skeleton-pulse 1.4s var(--ease) infinite;
}
.coin-list-item.skeleton-item .coin-list-symbol { width: 40px; height: 14px; }
.coin-list-item.skeleton-item .coin-list-name   { width: 70px; height: 12px; margin-top: 4px; }

.coin-list::-webkit-scrollbar { width: 6px; }
.coin-list::-webkit-scrollbar-thumb {
  background-color: var(--surface-hover);
  border-radius: 999px;
}
