:root {
  --bg: #0a0b14;
  --card: rgba(22, 24, 38, 0.72);
  --card-border: rgba(255, 255, 255, 0.08);
  --field: rgba(13, 14, 24, 0.65);
  --text: #f2f4ff;
  --muted: #8b8fa8;
  --accent: #ffb300;
  --accent-2: #7c5cff;
  --green: #1ecb8b;
  --radius: 18px;
  --shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
}

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

html, body { height: 100%; }
html { background: var(--bg); }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Decorative background */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.4;
  z-index: 0;
  pointer-events: none;
}
.orb-1 { width: 340px; height: 340px; background: var(--accent-2); top: -180px; left: -130px; opacity: 0.22; }
.orb-2 { width: 280px; height: 280px; background: var(--accent); bottom: -200px; right: -130px; opacity: 0.15; }

/* On phone-sized screens keep the orbs small so they don't flood the edges
   (which also stops mobile browsers tinting their toolbars). */
@media (max-width: 600px) {
  .orb-1 { width: 220px; height: 220px; top: -150px; left: -90px; opacity: 0.16; }
  .orb-2 { width: 190px; height: 190px; bottom: -170px; right: -90px; opacity: 0.1; }
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Bottom-anchored page footer (social link). */
.page-footer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  flex-shrink: 0;
  padding-top: 18px;
}

.app__header { text-align: center; margin-bottom: 22px; }

.logo {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(95deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo span { color: var(--text); -webkit-text-fill-color: var(--text); }
.tagline { color: var(--muted); font-size: 13.5px; margin-top: 6px; letter-spacing: 0.3px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: relative;
}

.field { margin: 0; }
.field__label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
}

.field__row {
  display: flex;
  gap: 10px;
  background: var(--field);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.field__row:focus-within {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.field__amount {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.field__amount--result { color: var(--green); }

/* Searchable combobox */
.combo { position: relative; flex-shrink: 0; }

.combo__button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 116px;
  max-width: 168px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 14px;
  cursor: pointer;
  outline: none;
  transition: background 0.18s ease;
}
.combo__button:hover { background: rgba(255, 255, 255, 0.09); }
.combo__label {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo__caret {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s ease;
}
.combo--open .combo__caret { transform: translateY(2px) rotate(225deg); }

.combo__pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  max-width: 78vw;
  background: #14162400;
  background: rgba(20, 22, 36, 0.98);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 20;
  overflow: hidden;
  padding: 8px;
}
.combo__pop[hidden] { display: none; }

.combo__search {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--card-border);
  border-radius: 9px;
  color: var(--text);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  margin-bottom: 8px;
}
.combo__search:focus {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.combo__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.combo__group {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 8px 10px 4px;
  font-weight: 700;
}
.combo__option {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.combo__option:hover,
.combo__option.is-active { background: rgba(124, 92, 255, 0.22); }
.combo__option.is-selected { background: rgba(255, 179, 0, 0.16); }
.combo__option .sym { font-weight: 700; flex-shrink: 0; }
.combo__option .nm {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo__empty { padding: 14px 10px; color: var(--muted); font-size: 13.5px; text-align: center; }

/* Slim scrollbar for the list */
.combo__list::-webkit-scrollbar { width: 8px; }
.combo__list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

/* Swap button */
.swap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -10px auto;
  position: relative;
  z-index: 2;
  background: linear-gradient(135deg, var(--accent-2), #5a3ce0);
  color: #fff;
  border: 4px solid var(--bg);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 20px -6px rgba(124, 92, 255, 0.8);
}
.swap:hover { transform: rotate(180deg); }
.swap:active { transform: rotate(180deg) scale(0.92); }

.rate {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
  line-height: 1.5;
}
.rate strong { color: var(--text); font-weight: 700; }
.rate.error { color: #ff6b6b; }

.app__footer { margin-top: 18px; }
.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.status__updated { font-size: 12px; color: var(--muted); }
.status__updated--stale { color: var(--accent); }

.status__refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease;
}
.status__refresh:hover { background: rgba(255, 255, 255, 0.12); }
.status__refresh svg { transition: transform 0.6s ease; }
.status__refresh.spinning svg { transform: rotate(360deg); }

.credit { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 12px; }
.credit a { color: var(--accent); text-decoration: none; }
.credit a:hover { text-decoration: underline; }

.built-by { text-align: center; margin-top: 8px; }
.built-by a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.18s ease, border-color 0.18s ease;
}
.built-by a:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 420px) {
  .field__amount { font-size: 20px; }
  .combo__button { min-width: 104px; max-width: 132px; font-size: 14px; }
}
