:root {
  color-scheme: light;
  --bg: #f9f9fb;
  --bg-strong: #ffffff;
  --surface: #ffffff;
  --surface-low: #f3f3f5;
  --surface-high: #eeeef0;
  --text: #1a1c1d;
  --muted: #636264;
  --subtle: #8f6f6e;
  --line: rgba(91, 64, 63, 0.16);
  --primary: #e63946;
  --primary-strong: #b7102a;
  --primary-soft: #ffdad8;
  --primary-text: #ffffff;
  --error: #ba1a1a;
  --shadow: 0 24px 60px rgba(50, 20, 24, 0.12);
  --shadow-soft: 0 14px 36px rgba(50, 20, 24, 0.08);
  --radius-card: 28px;
  --radius-control: 18px;
  --header-height: 72px;
  --field-height: 72px;
  --field-label-height: 15px;
  --field-label-gap: 8px;
  --field-gap: 4px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --bg-strong: #171717;
  --surface: #1c1c1e;
  --surface-low: #242426;
  --surface-high: #2b2b2d;
  --text: #f7f7f8;
  --muted: #b9b7ba;
  --subtle: #8f8789;
  --line: rgba(255, 255, 255, 0.1);
  --primary: #ff4b5c;
  --primary-strong: #ff6b78;
  --primary-soft: rgba(255, 75, 92, 0.18);
  --error: #ff8a8a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 4%, rgba(230, 57, 70, 0.12), transparent 30rem),
    radial-gradient(circle at 88% 18%, rgba(255, 218, 216, 0.38), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  transition: background-color 240ms ease, color 240ms ease;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: var(--header-height);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg-strong) 82%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(22px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
  border-radius: 12px;
  box-shadow: 0 10px 22px rgba(230, 57, 70, 0.28);
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle,
.language-toggle,
.close-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--text);
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.language-toggle {
  width: auto;
  min-width: 52px;
  padding: 0 14px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.theme-toggle__icon {
  transform-origin: center;
  transition: transform 240ms ease;
}

main {
  width: min(100%, 1200px);
  overflow: hidden;
  margin: 0 auto;
  padding: 56px 20px 80px;
}

.hero {
  max-width: 720px;
  margin: 0 auto 36px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.045em;
}

h1 {
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  line-height: 0.98;
}

.hero p:last-child {
  margin: 18px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.25rem);
}

.content-page {
  max-width: 860px;
}

.content-hero {
  margin-bottom: 28px;
  text-align: left;
}

.content-card {
  display: grid;
  gap: 22px;
  padding: clamp(22px, 5vw, 38px);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

.content-card h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.content-card p,
.content-card li {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.content-card p {
  margin: 0;
}

.content-card ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.content-card a {
  color: var(--primary);
  font-weight: 800;
}

.content-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  color: var(--primary-text) !important;
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(230, 57, 70, 0.22);
}

.text-button--secondary {
  color: var(--text) !important;
  background: var(--surface-low);
  border: 1px solid var(--line);
  box-shadow: none;
}

.converter-shell {
  position: relative;
  max-width: 540px;
  margin: 0 auto;
}

.glow {
  position: absolute;
  z-index: -1;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  filter: blur(44px);
  opacity: 0.7;
  pointer-events: none;
}

.glow--red {
  top: -42px;
  left: -54px;
  background: rgba(230, 57, 70, 0.2);
}

.glow--soft {
  right: -56px;
  bottom: -42px;
  background: rgba(255, 218, 216, 0.58);
}

[data-theme="dark"] .glow--soft {
  background: rgba(230, 57, 70, 0.1);
}

.converter-card {
  padding: clamp(18px, 4vw, 28px);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transition: transform 240ms ease, background-color 240ms ease, border-color 240ms ease, box-shadow 240ms ease;
}

.converter-card:hover {
  transform: translateY(-2px);
}

.status-line {
  min-height: 20px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.status-line.is-error {
  color: var(--error);
}

.converter-fields {
  display: grid;
  gap: var(--field-gap);
}

.currency-row {
  display: grid;
  gap: 8px;
  transition: opacity 220ms ease, transform 220ms ease;
}

#fromRow.is-moving {
  transform: translateY(10px);
  opacity: 0.58;
}

#toRow.is-moving {
  transform: translateY(-10px);
  opacity: 0.58;
}

.row-label {
  padding-left: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input-shell {
  display: flex;
  align-items: stretch;
  min-height: var(--field-height);
  overflow: hidden;
  background: var(--surface-low);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  transition: background-color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.input-shell:focus-within {
  background: var(--surface-high);
  border-color: color-mix(in srgb, var(--primary) 42%, transparent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 10%, transparent);
}

.input-shell input {
  width: 100%;
  min-width: 0;
  padding: 0 18px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: clamp(1.45rem, 6vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.input-shell input::-webkit-outer-spin-button,
.input-shell input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.input-shell input[type="number"] {
  appearance: textfield;
}

.currency-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 118px;
  padding: 0 15px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  font-weight: 800;
}

.currency-button:hover,
.currency-button:focus-visible {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.currency-flag {
  font-size: 1.3rem;
}

.swap-row {
  display: flex;
  height: 0;
  align-items: center;
  justify-content: center;
  justify-self: stretch;
  position: relative;
  z-index: 5;
  transform: translateY(calc((var(--field-label-gap, 8px) + var(--field-label-height, 15px)) / 2));
}

.swap-button {
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  position: relative;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: var(--primary-text);
  background: var(--surface);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 14px 30px rgba(230, 57, 70, 0.28), 0 0 0 5px var(--surface);
  outline: 0;
  transition: filter 180ms ease, transform 160ms ease;
  user-select: none;
}

.swap-button:hover,
.swap-button:focus,
.swap-button:active {
  background: var(--surface);
  color: var(--primary-text);
}

.swap-button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
  border-radius: inherit;
  pointer-events: none;
}

.swap-button::after {
  content: "";
  position: absolute;
  inset: -22px;
  z-index: -2;
  background: radial-gradient(circle, rgba(230, 57, 70, 0.2), transparent 62%);
  border-radius: inherit;
  pointer-events: none;
}

.swap-button:focus-visible::before {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 42%, transparent);
}

.swap-button:active::before {
  background: linear-gradient(145deg, var(--primary), var(--primary-strong));
}

.swap-button:active::after {
  opacity: 1;
}

.swap-icon {
  display: block;
  position: relative;
  z-index: 1;
  font-size: 1.45rem;
  line-height: 1;
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.swap-button.is-rotating .swap-icon {
  transform: rotate(180deg);
}

.rate-panel {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.rate-panel p {
  margin: 0;
}

.rate-panel p + p {
  margin-top: 5px;
}

.rate-panel p:first-child {
  font-weight: 700;
}

.rate-panel p:nth-child(2),
.disclaimer {
  color: var(--muted);
  font-size: 0.92rem;
}

.disclaimer {
  margin-top: 16px !important;
  font-size: 0.78rem;
  font-weight: 700;
}

.ad-section {
  margin-top: 64px;
}

.popular-section {
  margin-top: 56px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: clamp(1.75rem, 5vw, 3.25rem);
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.popular-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "icons meta"
    "rate rate";
  align-items: center;
  gap: 14px 12px;
  min-height: 132px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow-soft);
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.popular-card:hover,
.popular-card:focus-visible {
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
  transform: translateY(-3px);
}

.popular-card__icons {
  grid-area: icons;
  position: relative;
  display: flex;
  width: 54px;
  height: 42px;
  align-items: center;
}

.popular-card__icons span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(50, 20, 24, 0.08);
  font-size: 1.15rem;
}

.popular-card__icons span + span {
  margin-left: -14px;
}

.popular-card__meta {
  display: grid;
  min-width: 0;
  gap: 3px;
  grid-area: meta;
}

.popular-card__pair {
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.popular-card__names {
  color: var(--muted);
  overflow: hidden;
  font-size: 0.76rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popular-rate {
  grid-area: rate;
  align-self: end;
  justify-self: start;
  max-width: 100%;
  padding: 8px 12px;
  overflow: hidden;
  background: var(--surface-low);
  border-radius: 14px;
  color: var(--primary-strong);
  font-size: clamp(1.15rem, 4vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ad-card {
  display: grid;
  min-height: 118px;
  place-items: center;
  padding: 22px;
  color: var(--muted);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 7%, transparent), transparent),
    var(--surface);
  border: 1px dashed color-mix(in srgb, var(--primary) 38%, var(--line));
  border-radius: 26px;
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.ad-card > span {
  display: inline-grid;
  min-height: 56px;
  place-items: center;
  padding: 12px 24px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 800;
}

.seo-section,
.faq-section {
  margin-top: 64px;
}

.seo-card,
.faq-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow-soft);
}

.seo-card {
  display: grid;
  gap: 18px;
  padding: clamp(22px, 5vw, 34px);
}

.seo-card h2 {
  max-width: 780px;
  font-size: clamp(1.75rem, 5vw, 3rem);
  line-height: 1.02;
}

.seo-card p,
.seo-list li,
.faq-card p {
  color: var(--muted);
  line-height: 1.7;
}

.seo-card p {
  max-width: 820px;
  margin: 0;
}

.seo-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.faq-grid {
  display: grid;
  gap: 14px;
}

.faq-card {
  padding: 22px;
}

.faq-card h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.faq-card p {
  margin: 0;
}

.site-footer {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px 20px 46px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  font-weight: 700;
  transition: color 160ms ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--primary);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: end center;
  padding: 16px;
  pointer-events: none;
  visibility: hidden;
}

.modal.is-open {
  pointer-events: auto;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, 0.34);
  opacity: 0;
  backdrop-filter: blur(18px);
  transition: opacity 220ms ease;
}

.modal.is-open .modal-backdrop {
  opacity: 1;
}

.currency-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  max-height: min(78vh, 760px);
  padding: 14px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(28px) scale(0.98);
  transition: opacity 240ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.modal.is-open .currency-sheet {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.sheet-handle {
  width: 44px;
  height: 5px;
  margin: 0 auto 10px;
  background: var(--line);
  border-radius: 999px;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 8px 16px;
}

.sheet-header h2 {
  font-size: 1.6rem;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 16px;
  padding: 0 16px;
  background: var(--surface-low);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.search-shell input {
  width: 100%;
  height: 52px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.currency-list {
  display: grid;
  gap: 8px;
  padding: 0 4px 8px;
  overflow-y: auto;
}

.list-heading {
  margin: 10px 12px 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.currency-option {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 14px;
  padding: 14px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 18px;
  text-align: left;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.currency-option:hover,
.currency-option:focus-visible {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border-color: color-mix(in srgb, var(--primary) 26%, transparent);
}

.currency-option__flag {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  background: var(--surface-low);
  border-radius: 14px;
  font-size: 1.35rem;
}

.currency-option__meta {
  display: grid;
  gap: 2px;
}

.currency-option__code {
  font-weight: 800;
}

.currency-option__name {
  color: var(--muted);
  font-size: 0.9rem;
}

.pressable {
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.pressable:active {
  transform: scale(0.96);
}

.swap-button.pressable:active {
  transform: scale(0.92);
}

.value-pop {
  animation: value-pop 220ms ease;
}

@keyframes value-pop {
  from {
    opacity: 0.2;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 720px) {
  .site-header {
    top: 12px;
    height: 68px;
    padding: 0 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  main {
    padding-top: 72px;
  }

  .modal {
    place-items: center;
  }
}

@media (min-width: 1024px) {
  .popular-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .site-header {
    padding-inline: 14px;
  }

  .currency-button {
    min-width: 104px;
    padding: 0 10px;
  }

  .brand {
    font-size: 0.92rem;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .language-toggle {
    min-width: 46px;
    padding-inline: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
