:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #141a1c;
  background: #f3f5f2;
  --ink: #141a1c;
  --muted: #526064;
  --line: #dce2de;
  --blue: #3978ff;
  --blue-dark: #225ace;
  --gradient: linear-gradient(105deg, #3978ff 5%, #7ba6ff 48%, #c7f456 105%);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
h1, h2, p { margin: 0; }
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }

.site-header, .site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
}
.site-header { border-bottom: 1px solid var(--line); }
.site-header a { text-decoration: none; }
.brand { font-size: 1.1rem; font-weight: 800; }
nav { display: flex; align-items: center; gap: 24px; font-size: .875rem; font-weight: 700; }
.nav-pill { padding: 11px 17px; border-radius: 999px; color: #fff; background: var(--ink); }
.site-header a:hover:not(.nav-pill), .site-footer a:hover { color: var(--blue-dark); }
.nav-pill:hover { background: #354044; }

.hero { text-align: center; padding: 66px 0 61px; }
.hero h1 { font-size: clamp(2.5rem, 6.5vw, 5rem); letter-spacing: -.065em; line-height: .99; }
.hero h1 span {
  display: inline-block;
  color: var(--blue-dark);
  background: var(--gradient);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p { color: var(--muted); font-size: 1.12rem; line-height: 1.55; margin-top: 20px; }
h2 { font-size: clamp(1.65rem, 3.6vw, 2.35rem); letter-spacing: -.045em; line-height: 1.08; }
#rates, #converter { scroll-margin-top: 22px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.rate-controls { display: flex; align-items: end; gap: 10px; }
.field { display: grid; gap: 8px; min-width: 0; font-size: .875rem; font-weight: 700; }
.field input, .field select, .outline-button, .primary-button, .swap {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.field input, .field select {
  width: 100%;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
}
.field select {
  appearance: none;
  padding-right: 32px;
  text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 49%, var(--muted) 51%),
    linear-gradient(135deg, var(--muted) 49%, transparent 51%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.date-field { min-width: 154px; }
.outline-button, .primary-button { padding: 9px 14px; font-size: .875rem; font-weight: 700; }
.outline-button, .swap { background: white; color: var(--ink); }
.outline-button:hover:enabled, .swap:hover:enabled { border-color: var(--blue); color: var(--blue-dark); }
.primary-button { background: var(--blue-dark); border-color: var(--blue-dark); color: white; }
.primary-button:hover { background: #1949ac; }

.feedback { display: flex; align-items: center; gap: 12px; min-height: 50px; padding-block: 8px; }
.feedback p, .muted { color: var(--muted); font-size: .875rem; line-height: 1.45; }
.feedback[data-error] p, .input-error { color: #9e342d; }
.rate-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.panel, .rate-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.rate-card { padding: 19px 20px 17px; min-width: 0; }
.rate-card h3 { margin: 0 0 8px; font-size: 1rem; line-height: 1.25; }
.rate-card h3 span { display: block; color: var(--blue-dark); font-size: .875rem; margin-bottom: 5px; }
.rate-value { font-size: clamp(1.45rem, 2.6vw, 2.05rem); letter-spacing: -.045em; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rate-unit { margin-top: 5px; color: var(--muted); font-size: .875rem; }
.empty-rates { grid-column: 1 / -1; }
.converter { margin-top: 32px; padding: 26px; }
.converter-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; margin-top: 20px; }
.converter-controls { display: grid; align-content: start; gap: 13px; }
.currency-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 9px; align-items: end; }
.swap { font-size: 1.3rem; line-height: 1; width: 44px; padding: 0; }
.input-error { font-size: .875rem; }
.result {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 145px;
  padding: 19px;
  border: 1px solid #dce4ef;
  border-radius: 9px;
  background: linear-gradient(105deg, #eef3ff, #f4fae7);
}
.result-label { font-size: .875rem; font-weight: 700; color: var(--muted); }
.result output { font-size: clamp(1.6rem, 4vw, 2.65rem); letter-spacing: -.05em; line-height: 1.12; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result p { font-size: .875rem; line-height: 1.45; color: var(--muted); }
.result p:empty { display: none; }
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; color: var(--muted); font-size: .875rem; }

dialog { width: min(470px, calc(100% - 28px)); max-height: calc(100% - 24px); padding: 23px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); box-shadow: 0 18px 60px #141a1c26; }
dialog::backdrop { background: #141a1c66; }
.dialog-head, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dialog-head { margin-bottom: 16px; }
.dialog-head h2 { font-size: 1.65rem; }
.currency-list { display: grid; max-height: min(300px, 40vh); overflow: auto; margin: 10px 0; }
.currency-list label { display: flex; align-items: center; gap: 10px; min-height: 43px; padding: 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.currency-list input { width: 17px; height: 17px; accent-color: var(--blue-dark); }
.dialog-actions { margin-top: 16px; }

@media (max-width: 740px) {
  .wrap { width: calc(100% - 36px); }
  .hero { padding: 49px 0 42px; }
  .rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .converter-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (max-width: 470px) {
  .site-header { min-height: 61px; }
  nav { gap: 12px; }
  .nav-pill { padding: 9px 11px; }
  .hero p { font-size: 1rem; }
  .section-head { align-items: stretch; flex-direction: column; gap: 13px; }
  .rate-controls { justify-content: space-between; }
  .date-field { min-width: 0; flex: 1; }
  .rate-card { padding: 13px; }
  .converter { padding: 17px; }
  .site-footer { flex-wrap: wrap; justify-content: flex-start; min-height: 0; padding-block: 18px; gap: 8px 16px; }
}
@media (forced-colors: active) {
  .hero h1 span { background: none; color: CanvasText; -webkit-text-fill-color: currentColor; }
}
