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

:root {
  --bg: #0b1220;
  --card: rgba(18, 28, 47, 0.94);
  --input: #111c30;
  --border: #263653;
  --text: #f4f7fb;
  --muted: #94a3b8;
  --accent: #6c63ff;
  --accent2: #8b83ff;
  --success: #35d07f;
  --danger: #ff6b6b;
}

body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(108, 99, 255, .22), transparent 30%),
    radial-gradient(circle at 90% 85%, rgba(53, 208, 127, .12), transparent 25%),
    var(--bg);
  display: grid;
  place-items: center;
  padding: 24px;
}

.app {
  width: 100%;
  max-width: 540px;
}

.converter-card {
  background: var(--card);
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 28px;
  padding: 30px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, .35);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
}

.brand-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-size: 27px;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(108, 99, 255, .28);
}

h1 {
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: -.7px;
}

.brand p {
  color: var(--muted);
  margin-top: 6px;
  font-size: 14px;
}

label {
  display: block;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 9px;
}

.amount-section {
  margin-bottom: 20px;
}

.amount-input {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 0 16px;
  transition: border-color .2s, box-shadow .2s;
}

.amount-input:focus-within,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, .12);
}

.amount-input span {
  color: var(--muted);
  font-size: 22px;
}

input, select {
  width: 100%;
  height: 54px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 17px;
  font-weight: 600;
}

.currency-grid {
  display: grid;
  grid-template-columns: 1fr 48px 1fr;
  align-items: end;
  gap: 12px;
  margin-bottom: 22px;
}

.field select {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 0 13px;
  cursor: pointer;
}

.swap-btn {
  width: 48px;
  height: 48px;
  margin-bottom: 3px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #17243a;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  transition: transform .2s, background .2s;
}

.swap-btn:hover {
  transform: rotate(180deg);
  background: var(--accent);
}

.convert-btn {
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 15px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(108, 99, 255, .22);
  transition: transform .15s, filter .15s;
}

.convert-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.convert-btn:disabled {
  cursor: wait;
  opacity: .65;
  transform: none;
}

.result {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid rgba(108, 99, 255, .25);
  border-radius: 18px;
  background: rgba(108, 99, 255, .07);
  text-align: center;
}

.result-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

#resultValue {
  display: block;
  font-size: 34px;
  letter-spacing: -.8px;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.rate-text {
  color: #b7c3d6;
  font-size: 13px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.status-dot.error {
  background: var(--danger);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 24px;
  color: #64748b;
  font-size: 11px;
}

@media (max-width: 520px) {
  body { padding: 14px; }
  .converter-card { padding: 22px; border-radius: 22px; }
  h1 { font-size: 23px; }
  .currency-grid { grid-template-columns: 1fr; }
  .swap-btn {
    justify-self: center;
    margin: -3px 0 0;
  }
  footer { flex-direction: column; text-align: center; }
}
