:root {
  color-scheme: light;
  --bg: #f2f5f7;
  --ink: #17191f;
  --muted: #5e6976;
  --panel: #ffffff;
  --line: #d9dee3;
  --accent: #0d5f79;
  --accent-2: #c29a42;
  --accent-3: #253f67;
  --soft: #e8f2f5;
  --gold: #d7b35b;
  --navy: #16243c;
  --shadow: 0 24px 70px rgba(28, 35, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, auto);
  align-items: start;
  gap: 24px;
  padding: 18px 0 22px;
}

.brand-block {
  display: grid;
  gap: 12px;
}

.brand-mark {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 14px;
  color: var(--navy);
}

.brand-vb {
  display: inline-grid;
  width: 104px;
  height: 60px;
  place-items: center;
  border: 5px solid rgba(215, 179, 91, 0.72);
  background:
    linear-gradient(135deg, rgba(215, 179, 91, 0.18), rgba(255, 255, 255, 0.6)),
    #fff;
  color: var(--navy);
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.brand-word {
  display: grid;
  gap: 2px;
  line-height: 1;
}

.brand-word strong {
  color: var(--navy);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-word small {
  color: rgba(22, 36, 60, 0.48);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
}

.eyebrow,
.subtitle,
.hero-meta,
.section-heading span,
.quote-card span,
.site-footer p,
label span,
.toggle-line {
  color: var(--muted);
}

.eyebrow {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(38px, 7vw, 78px);
  line-height: 0.9;
  letter-spacing: 0;
}

.subtitle {
  margin-top: 4px;
  max-width: 620px;
  font-size: 18px;
  line-height: 1.55;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.powered-by {
  display: grid;
  gap: 3px;
  min-height: 42px;
  justify-content: end;
  color: var(--muted);
  text-align: right;
  text-decoration: none;
}

.powered-by span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.powered-by strong {
  color: var(--accent-3);
  font-size: 15px;
  font-weight: 900;
}

.powered-by:hover strong,
.powered-by:focus-visible strong {
  color: var(--accent);
}

button {
  border: 0;
  cursor: pointer;
}

#refreshBtn,
.mode-tab,
.swap-button {
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

#refreshBtn {
  border-radius: 7px;
  padding: 0 16px;
  font-weight: 750;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 18px;
  align-items: stretch;
}

.calculator,
.result-panel,
.market-section,
.site-footer {
  border: 1px solid rgba(33, 41, 51, 0.08);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.calculator,
.result-panel {
  padding: 22px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

.language-control {
  display: grid;
  min-width: 170px;
  gap: 6px;
}

.language-control select {
  min-height: 42px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 106, 91, 0.14);
}

.amount-row input {
  min-height: 64px;
  font-size: 30px;
  font-weight: 850;
}

.currency-grid {
  display: grid;
  grid-template-columns: 1fr 52px 1fr;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
}

.quick-pairs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.quick-pairs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  color: var(--accent-3);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.quick-pairs button:hover,
.quick-pairs button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.swap-button {
  border-radius: 50%;
  aspect-ratio: 1;
  font-size: 24px;
  color: var(--accent-3);
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.mode-tab {
  border-radius: 6px;
  font-weight: 800;
}

.mode-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.toggle-line {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
}

.toggle-line input {
  width: 18px;
  min-height: 18px;
}

.result-panel {
  display: grid;
  gap: 18px;
  align-content: start;
  background: #18201f;
  color: #fff;
}

.result-header {
  display: grid;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.result-header span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  font-weight: 800;
}

.result-header strong {
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.metrics {
  display: grid;
  gap: 10px;
  margin: 0;
}

.metrics div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

[dir="rtl"] .metrics div {
  flex-direction: row-reverse;
}

[dir="rtl"] dd {
  text-align: left;
}

[dir="rtl"] .swap-button {
  transform: scaleX(-1);
}

dt {
  color: rgba(255, 255, 255, 0.62);
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 850;
}

.quote-card {
  display: grid;
  gap: 9px;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.quote-card p {
  line-height: 1.55;
}

.quote-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quote-actions button {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 850;
}

.quote-actions button:hover,
.quote-actions button:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.action-status {
  min-height: 20px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.saved-quotes {
  display: grid;
  gap: 10px;
}

.saved-quotes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  font-weight: 850;
}

.saved-quotes-header small {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 800;
}

.saved-quotes-list {
  display: grid;
  gap: 8px;
}

.saved-quote {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.saved-quote-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.saved-quote strong {
  overflow-wrap: anywhere;
}

.saved-quote small,
.saved-quote p {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.45;
}

.saved-quote button {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.market-section,
.site-footer {
  margin-top: 18px;
  padding: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h2 {
  font-size: 22px;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.market-tile {
  display: grid;
  min-height: 104px;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.market-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.market-tile strong {
  font-size: 24px;
  overflow-wrap: anywhere;
}

.market-tile small {
  color: var(--accent-2);
  font-weight: 750;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.site-footer {
  display: grid;
  gap: 18px;
  border: 1px solid rgba(33, 41, 51, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(22, 36, 60, 0.98), rgba(13, 95, 121, 0.92)),
    var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.footer-brand p {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
  text-align: right;
}

.brand-mark.compact {
  color: #fff;
}

.brand-mark.compact .brand-vb {
  width: 82px;
  height: 48px;
  border-color: rgba(215, 179, 91, 0.82);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 28px;
}

.brand-mark.compact .brand-word strong {
  color: #fff;
  font-size: 24px;
}

.brand-mark.compact .brand-word small {
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
}

.footer-grid section {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.footer-grid h2 {
  color: #fff;
  font-size: 16px;
}

.footer-grid p {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  line-height: 1.5;
}

.footer-bottom a {
  color: var(--gold);
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .hero,
  .workspace,
  .scenario-row,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-brand,
  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .hero {
    align-items: start;
  }

  .hero-meta {
    justify-content: space-between;
  }

  .powered-by {
    justify-content: start;
    text-align: left;
  }

  [dir="rtl"] .powered-by {
    text-align: right;
  }

  .input-grid,
  .market-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 16px;
  }

  .brand-mark {
    gap: 10px;
  }

  .brand-vb {
    width: 78px;
    height: 48px;
    border-width: 4px;
    font-size: 27px;
  }

  .brand-word strong {
    font-size: 23px;
  }

  .brand-word small {
    font-size: 13px;
  }

  h1 {
    font-size: 38px;
  }

  .subtitle {
    font-size: 15px;
  }

  .hero-meta {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .powered-by,
  .language-control,
  #rateStatus {
    grid-column: 1 / -1;
  }

  .calculator,
  .result-panel,
  .market-section,
  .site-footer {
    padding: 16px;
  }

  .footer-grid section {
    min-height: auto;
  }

  .currency-grid {
    grid-template-columns: 1fr;
  }

  .quick-pairs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .swap-button {
    justify-self: center;
    transform: rotate(90deg);
  }

  [dir="rtl"] .swap-button {
    transform: rotate(90deg) scaleX(-1);
  }

  .input-grid,
  .market-grid,
  .mode-tabs,
  .quote-actions {
    grid-template-columns: 1fr;
  }

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

  .section-heading span {
    overflow-wrap: anywhere;
  }

  .amount-row input {
    font-size: 24px;
  }
}
