:root {
  color-scheme: light;
  --navy: #112f3f;
  --navy-deep: #0b2431;
  --cyan: #47b2d7;
  --blue: #1e84bf;
  --ink: #17303d;
  --muted: #60737d;
  --line: #dce7eb;
  --surface: #fff;
  --soft: #f3f8fa;
  --buy: #07852e;
  --sell: #ec1c24;
  --shadow: 0 18px 55px rgb(17 47 63 / 10%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--soft);
  color: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
}

button, input, select {
  font: inherit;
}

a {
  color: inherit;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 8px;
  inset-inline-start: 8px;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.site-header {
  color: #fff;
  background: var(--navy);
  border-bottom: 3px solid var(--cyan);
}

.app-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 24px;
  min-height: 90px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  min-width: 0;
}

.brand img {
  flex: 0 0 auto;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, .18));
}

.brand span {
  display: grid;
}

.brand strong {
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  line-height: 1;
  letter-spacing: -.035em;
}

.brand small {
  margin-top: 6px;
  color: rgb(255 255 255 / 70%);
  font-size: .92rem;
}

.basirsoft-mark {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .8rem;
  color: var(--cyan);
  border: 1px solid rgb(71 178 215 / 35%);
  border-radius: 2rem;
  font-size: .8rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.basirsoft-mark img {
  width: 28px;
  height: 28px;
}

.freshness {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  margin-top: 24px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 26px rgb(17 47 63 / 6%);
}

.freshness.stale {
  background: #fff8e8;
}

.freshness.error {
  background: #fff4f4;
}

.freshness.demo {
  color: #155d7f;
  background: #edf8fc;
  border-color: #bfe6f4;
}

.status-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--buy);
  flex: 0 0 auto;
}

.stale .status-dot {
  background: #d88a00;
}

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

.demo .status-dot {
  background: var(--cyan);
}

.freshness button {
  display: grid;
  width: 44px;
  height: 44px;
  margin-inline-start: auto;
  border: 0;
  background: transparent;
  color: var(--buy);
  font-size: 1.8rem;
  line-height: 1;
  place-items: center;
  cursor: pointer;
}

.freshness button:disabled {
  opacity: .45;
  animation: spin 1s linear infinite;
}

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

.app-grid {
  display: grid;
  grid-template-columns:minmax(0, 1.45fr) minmax(320px, .75fr);
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rates-head, .rate-row {
  display: grid;
  grid-template-columns:minmax(170px, 1.5fr) minmax(80px, .7fr) minmax(80px, .7fr);
  align-items: center;
  gap: 14px;
}

.rates-head {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .84rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.buy {
  color: var(--buy);
}

.sell {
  color: var(--sell);
}

.rate-row {
  min-height: 82px;
  margin-inline: 24px;
  border-bottom: 1px solid var(--line);
}

.rate-row:last-child {
  border-bottom: 0;
}

.currency {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.currency-flag {
  display: grid;
  place-items: center;
  width: 44px;
  height: 32px;
  overflow: hidden;
  color: var(--blue);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .05em;
}

.currency-flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.currency-name {
  display: grid;
  min-width: 0;
}

.currency-name strong {
  font-size: 1.12rem;
}

.currency-name span {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rate-value {
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
  font-weight: 800;
}

.empty-state {
  padding: 50px 24px;
  text-align: center;
}

.empty-state span {
  display: block;
  margin: 8px 0 20px;
  color: var(--muted);
}

.converter {
  padding: 24px;
}

.converter h2 {
  margin: 0 0 20px;
  font-size: 1.25rem;
}

.converter-fields {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}

.amount-field {
  grid-column: 1 / -1;
  display: grid;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.amount-field span,
.currency-field span {
  color: var(--muted);
  font-size: .84rem;
}

.amount-field input {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.75rem;
  font-weight: 700;
}

.currency-field {
  display: grid;
  gap: 6px;
}

.currency-control {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding-inline-start: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.currency-control img {
  flex: 0 0 auto;
  width: 28px;
  height: 19px;
  border: 1px solid var(--line);
  border-radius: 3px;
  object-fit: cover;
}

.currency-field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--ink);
  border: 0;
  background: transparent;
  font-weight: 700;
}

.swap-button {
  width: 46px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--blue);
  font-size: 1.2rem;
  cursor: pointer;
}

.swap-button:hover,
.swap-button:focus-visible {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.conversion-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.conversion-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.conversion-result > span {
  grid-column: 1 / -1;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.conversion-result strong {
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

.conversion-result small {
  align-self: end;
  color: var(--muted);
  font-weight: 800;
}

.conversion-result--buy > span,
.conversion-result--buy strong {
  color: var(--buy);
}

.conversion-result--sell > span,
.conversion-result--sell strong {
  color: var(--sell);
}

.conversion-note {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.promotion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-block: 24px;
  padding: 24px 28px;
  color: rgb(255 255 255 / 76%);
  border: 1px solid var(--navy);
  border-radius: 1.1rem;
  background: var(--navy);
  box-shadow: var(--shadow);
}

.promotion strong {
  font-size: 1.15rem;
}

.promotion p {
  max-width: 700px;
  margin: 6px 0 0;
  color: rgb(255 255 255 / 65%);
}

.promotion strong {
  color: #fff;
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: .65rem;
  background: var(--cyan);
  color: var(--navy);
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.site-footer {
  background: var(--navy-deep);
  color: rgb(255 255 255 / 72%);
  font-size: .88rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 88px;
  padding-block: 18px;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 4px;
  color: var(--cyan);
  font-weight: 700;
  text-decoration: none;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  gap: 18px;
}

[dir="rtl"] .rate-value, [dir="rtl"] input {
  direction: ltr;
  text-align: right;
}

@media (max-width: 780px) {
  .container {
    width: min(100% - 24px, 680px);
  }

  .app-header {
    grid-template-columns: 1fr auto;
    gap: 10px;
    min-height: 82px;
    padding-block: 12px;
  }

  .brand img {
    width: 52px;
    height: 52px;
  }

  .brand small {
    font-size: .76rem;
  }

  .basirsoft-mark {
    justify-self: end;
    min-width: 44px;
    min-height: 44px;
    padding: .4rem;
  }

  .basirsoft-mark img {
    width: 28px;
    height: 28px;
  }

  .basirsoft-mark span {
    display: none;
  }

  .app-grid {
    grid-template-columns:1fr;
    gap: 18px;
  }

  .rates-head, .rate-row {
    grid-template-columns:minmax(130px, 1.35fr) minmax(70px, .7fr) minmax(70px, .7fr);
    gap: 8px;
  }

  .rates-head {
    padding-inline: 14px;
  }

  .rate-row {
    min-height: 72px;
    margin-inline: 14px;
  }

  .currency-flag {
    width: 34px;
    height: 27px;
    font-size: 1rem;
  }

  .currency-name span {
    font-size: .78rem;
  }

  .rate-value {
    font-size: 1rem;
  }

  .promotion {
    align-items: flex-start;
    flex-direction: column;
  }

  .promotion .button {
    width: 100%;
  }

  .footer-content {
    flex-direction: column;
    justify-content: center;
    min-height: 150px;
    text-align: center;
  }
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

@media (max-width: 430px) {
  .brand strong {
    font-size: 1.45rem;
  }

  .currency-name span {
    display: none;
  }

  .converter {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation: none !important;
  }
}

.legal {
  max-width: 760px;
  padding-block: 40px 70px;
  line-height: 1.7;
}

.legal .brand {
  margin-bottom: 48px;
}

.legal h1 {
  margin-bottom: 24px;
  font-size: clamp(2rem, 6vw, 3.25rem);
}

.legal h2 {
  margin-top: 32px;
}

.legal p {
  color: var(--muted);
}

.legal a:not(.button):not(.brand) {
  color: var(--buy);
}
