:root {
  --ink: #18172a;
  --muted: #77758a;
  --purple: #6d4aff;
  --purple-dark: #5938e6;
  --purple-soft: #f0edff;
  --line: #e8e5ef;
  --surface: #ffffff;
  --page: #f6f5fa;
  --shadow: 0 28px 75px rgba(38, 27, 81, 0.12), 0 4px 15px rgba(38, 27, 81, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, rgba(108, 74, 255, 0.08), transparent 25rem),
    radial-gradient(circle at 88% 42%, rgba(47, 200, 220, 0.06), transparent 24rem),
    var(--page);
  font-family: "DM Sans", sans-serif;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
.page-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-family: Manrope, sans-serif;
  font-size: 21px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: linear-gradient(145deg, #8166ff, #5833e8);
  box-shadow: 0 8px 18px rgba(109, 74, 255, .24);
}
.brand-mark svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #31c891; box-shadow: 0 0 0 4px rgba(49, 200, 145, .12); }

main { width: min(940px, calc(100% - 40px)); margin: 0 auto; flex: 1; }
.hero { text-align: center; padding: 52px 0 44px; }
.eyebrow { color: var(--purple); font-size: 11px; font-weight: 700; letter-spacing: .18em; margin-bottom: 20px; }
.eyebrow span { margin-right: 5px; }
.hero h1 { margin: 0; font-family: Manrope, sans-serif; font-size: clamp(42px, 6vw, 67px); line-height: 1.05; letter-spacing: -.055em; font-weight: 800; }
.hero h1 span { color: var(--purple); }
.hero p { margin: 22px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }

.converter-card { max-width: 780px; margin: 0 auto; overflow: hidden; border: 1px solid rgba(225, 221, 236, .9); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.category-tabs { display: grid; grid-template-columns: repeat(5, 1fr); padding: 12px 18px 0; border-bottom: 1px solid var(--line); }
.tab {
  position: relative;
  border: 0;
  padding: 17px 7px 18px;
  color: #858294;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: color .2s ease;
}
.tab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--purple); transform: scaleX(0); transition: transform .2s ease; }
.tab:hover, .tab.active { color: var(--purple); }
.tab.active::after { transform: scaleX(1); }

.converter-body { padding: 33px 38px 34px; }
.field-label, .unit-field label, .result-label { display: block; margin-bottom: 10px; color: #8c8999; font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.input-wrap { position: relative; }
.input-wrap input { width: 100%; height: 74px; padding: 0 92px 0 22px; border: 1.5px solid #ddd9e8; border-radius: 14px; outline: none; color: var(--ink); background: #fff; font-size: 30px; font-weight: 600; transition: border-color .2s, box-shadow .2s; }
.input-wrap input:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(109, 74, 255, .1); }
.input-unit { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); color: #8d899b; font-size: 18px; font-weight: 600; }

.units-row { display: grid; grid-template-columns: 1fr 44px 1fr; align-items: end; gap: 15px; margin-top: 25px; }
.select-wrap { position: relative; height: 65px; display: flex; align-items: center; border: 1.5px solid #e1deea; border-radius: 13px; background: #fff; transition: border-color .2s; }
.select-wrap:focus-within { border-color: var(--purple); }
.unit-symbol { width: 58px; color: var(--purple); font-size: 16px; font-weight: 700; text-align: center; }
.select-wrap select { min-width: 0; flex: 1; height: 100%; padding: 0 31px 0 0; border: 0; outline: 0; color: var(--ink); background: transparent; appearance: none; font-size: 15px; font-weight: 600; text-overflow: ellipsis; }
.select-wrap svg { pointer-events: none; position: absolute; right: 12px; width: 18px; fill: none; stroke: #9793a4; stroke-width: 1.8; }
.swap-button { width: 44px; height: 44px; margin-bottom: 10px; display: grid; place-items: center; border: 1px solid #e0ddec; border-radius: 50%; color: var(--purple); background: var(--purple-soft); transition: transform .25s, background .2s, color .2s; }
.swap-button:hover { background: var(--purple); color: white; transform: rotate(180deg); }
.swap-button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.result-panel { margin-top: 27px; min-height: 105px; padding: 24px 26px; border: 1px solid #e4ddff; border-radius: 16px; background: linear-gradient(115deg, #f3efff 0%, #faf8ff 65%, #f2efff 100%); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.result-label { color: var(--purple); margin-bottom: 9px; }
.result-context { margin: 0; color: #767287; font-size: 13px; }
.result-value { color: var(--purple); font-family: Manrope, sans-serif; font-size: clamp(27px, 4vw, 36px); font-weight: 800; letter-spacing: -.04em; text-align: right; overflow-wrap: anywhere; }
.result-value span { font-family: "DM Sans"; font-size: 16px; font-weight: 600; letter-spacing: 0; }
.result-value.loading { font-size: 16px; letter-spacing: 0; }
.rate-info { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; color: #9692a2; font-size: 11px; }
.rate-info[hidden] { display: none; }
.rate-info button { border: 0; color: var(--purple); background: none; font-size: 11px; font-weight: 700; }

.features { max-width: 780px; margin: 48px auto 65px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.features article { display: flex; gap: 14px; align-items: flex-start; }
.feature-icon { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; font-weight: 700; }
.feature-icon.purple { color: #7253ef; background: #eeeaff; }
.feature-icon.cyan { color: #1bb0c2; background: #e5f8fa; }
.feature-icon.orange { color: #ed8b45; background: #fff0e5; }
.features h2 { margin: 1px 0 5px; font-size: 14px; }
.features p { margin: 0; color: #8a8798; font-size: 11px; line-height: 1.5; }
footer { padding: 24px; border-top: 1px solid rgba(225, 222, 232, .8); color: #a3a0ad; text-align: center; font-size: 11px; }
footer span { margin: 0 7px; color: #c2becd; }

@media (max-width: 680px) {
  .topbar { width: calc(100% - 32px); height: 72px; }
  .status { font-size: 0; }
  main { width: calc(100% - 24px); }
  .hero { padding: 34px 0 30px; }
  .hero h1 { font-size: clamp(38px, 12vw, 52px); }
  .hero p { font-size: 15px; }
  .desktop-only { display: none; }
  .converter-card { border-radius: 20px; }
  .category-tabs { padding: 8px 5px 0; }
  .tab { padding: 13px 2px 14px; font-size: 0; }
  .tab svg { width: 21px; height: 21px; }
  .converter-body { padding: 26px 18px 24px; }
  .input-wrap input { height: 66px; font-size: 25px; }
  .units-row { grid-template-columns: 1fr 38px 1fr; gap: 7px; }
  .select-wrap { height: 60px; }
  .unit-symbol { display: none; }
  .select-wrap select { padding: 0 29px 0 12px; font-size: 13px; }
  .swap-button { width: 38px; height: 38px; margin-bottom: 11px; }
  .result-panel { padding: 20px; align-items: flex-start; flex-direction: column; gap: 12px; }
  .result-value { width: 100%; text-align: left; }
  .features { margin: 34px 8px 48px; grid-template-columns: 1fr; gap: 20px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
