* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Roboto", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
}

:root {
  --bg: #7C3AED;
  --bg-dark: #5B21B6;
  --card: #F4F4F4;
  --text: #111827;
  --white: #FFFFFF;
  --soft-purple: #F3E8FF;
  --soft-purple-2: #EDE9FE;
  --border: #D1D5DB;
}

body { background: var(--bg); }

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.app {
  width: 100%;
  max-width: 420px;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.logo {
  width: min(320px, 78vw);
  max-width: 100%;
  height: auto;
  display: block;
}

.card {
  width: 100%;
  background: var(--card);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.20);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.field-label {
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
  text-align: center;
}

select,
.input-amount {
  height: 40px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  background: var(--white);
  outline: none;
  font-size: 15px;
  text-align: center;
}

select:focus,
.input-amount:focus { border-color: var(--bg); }

.input-amount.is-invalid {
  border-color: #DC2626;
  background: #FEF2F2;
}

.swap-button,
.copy-button,
.install-icon-button {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
}

.swap-button {
  width: 100%;
  height: 40px;
  background: var(--bg-dark);
  color: var(--white);
  font-size: 15px;
}

.swap-button:hover,
.copy-button:hover,
.install-icon-button:hover {
  opacity: 0.96;
}

.rate-info,
.status-message {
  min-height: 18px;
  font-size: 12px;
  text-align: center;
}

.rate-info {
  margin-top: 8px;
  color: var(--text);
}

.status-message {
  color: var(--bg-dark);
  margin-top: 2px;
}

.status-message.is-info { color: #5B21B6; }
.status-message.is-warning { color: #B45309; }
.status-message.is-error { color: #DC2626; }

.result-card {
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid var(--bg);
  background: var(--white);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #E5E7EB;
  display: grid;
  place-items: center;
  padding: 6px;
  flex-shrink: 0;
}

.flag {
  width: 30px;
  height: 20px;
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
}

.result-texts {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.badge-code {
  font-size: 15px;
  font-weight: 800;
  color: #388FFA;
  line-height: 1.1;
}

.result-name {
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  word-break: break-word;
}

.result-amount-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.result-amount-box {
  min-width: 108px;
  border: 1px solid #D8B4FE;
  border-radius: 12px;
  background: #FAF5FF;
  padding: 10px 12px;
  text-align: right;
}

.result-amount-box--highlight {
  border-color: var(--bg);
  background: var(--soft-purple);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.12);
}

.result-value {
  font-size: 21px;
  color: #0F172A;
  font-weight: 900;
  line-height: 1.1;
  word-break: break-word;
}

.copy-button {
  min-width: 88px;
  height: 34px;
  background: var(--soft-purple-2);
  color: var(--bg);
  font-size: 13px;
  padding: 0 12px;
}

.result-divider {
  display: grid;
  place-items: center;
  padding: 0;
}

.result-arrow {
  width: 24px;
  height: auto;
  opacity: 0.92;
}

.app-footer {
  width: 100%;
  color: var(--white);
  font-size: 12px;
  opacity: 0.95;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.footer-left {
  text-align: left;
}

.app-footer strong { font-weight: 700; }

.footer-links { margin-top: 4px; }

.footer-links a {
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover { text-decoration: underline; }

.install-icon-button {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.28);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.install-icon-button img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 7px;
}

.install-icon-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.app-loading {
  position: fixed;
  inset: 0;
  background: rgba(124, 58, 237, 0.96);
  display: grid;
  place-items: center;
  z-index: 9999;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.app-loading.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-loading__card {
  width: min(320px, 86vw);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  border-radius: 22px;
  padding: 24px 20px;
  text-align: center;
  color: var(--white);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.22);
}

.app-loading__icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  padding: 6px;
  display: block;
  margin: 0 auto 14px;
}

.app-loading__spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.28);
  border-top-color: var(--white);
  animation: spin 0.9s linear infinite;
}

.app-loading__title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}

.app-loading__text {
  font-size: 13px;
  opacity: 0.92;
}

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

@media (max-width: 420px) {
  .page { padding: 12px; }
  .logo { width: min(260px, 84vw); }
  .card { padding: 12px; }
  .result-row { grid-template-columns: 1fr; gap: 8px; }
  .result-amount-actions { justify-items: stretch; }
  .result-amount-box, .copy-button { width: 100%; }
  .footer-row { align-items: flex-start; }
}
