:root {
  color-scheme: light;
  --bg: #f4f6f1;
  --card: #fff;
  --text: #182b29;
  --muted: #71807b;
  --line: #dce5df;
  --accent: #176b58;
  --accent-soft: #e8f1e9;
  --warning: #775417;
  --error: #aa3434;
  --app-height: 100svh;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
input:focus {
  outline: none;
}
input[aria-invalid="true"] {
  color: var(--error);
}
.app {
  max-width: 480px;
  margin: auto;
  min-height: var(--app-height);
  padding: max(22px, env(safe-area-inset-top), var(--tg-safe-top, 0px)) 24px
    max(18px, env(safe-area-inset-bottom), var(--tg-safe-bottom, 0px));
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  font-size: 21px;
  font-weight: 760;
  letter-spacing: -0.8px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-right: 9px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  font-size: 24px;
  font-weight: 400;
}
.brand-dot {
  color: var(--accent);
}
.icon-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.intro {
  padding: 35px 0 28px;
}
.eyebrow {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.8px;
  color: var(--muted);
  margin: 0 0 13px;
}
h1 {
  font-size: clamp(37px, 10.8vw, 49px);
  line-height: 1.08;
  letter-spacing: -2px;
  margin: 0;
  font-weight: 650;
}
h1 span {
  color: var(--accent);
}
.subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  margin: 16px 0 0;
}
.trip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  margin: 0 1px 13px;
}
.currency-chip {
  font-size: 11px;
  letter-spacing: 1px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 10px;
  color: var(--muted);
}
.calculator {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 23px 23px 25px;
  box-shadow: 0 7px 24px #173c2410;
}
.amount-card label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 9px;
}
.amount-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.amount-line input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  font-size: clamp(32px, 10vw, 43px);
  font-weight: 550;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  border-radius: 0;
}
.amount-line input::placeholder {
  color: #b7c1ba;
  opacity: 1;
}
.unit {
  color: var(--muted);
  font-size: 23px;
  flex-shrink: 0;
}
.rub-card input {
  color: var(--accent);
}
.rub-card .unit {
  color: var(--accent);
}
.conversion-divider {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 19px 0 18px;
  color: var(--muted);
}
.conversion-divider > span:first-child {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  font-size: 18px;
}
.conversion-divider i {
  height: 1px;
  flex: 1;
  background: var(--line);
}
.divider-note {
  font-size: 10px;
  letter-spacing: 0.3px;
}
.error {
  font-size: 12px;
  line-height: 1.5;
  color: var(--error);
  margin: 9px 2px;
  min-height: 0;
}
.error:empty {
  display: none;
}
.rate-card {
  border-radius: 17px;
  background: var(--accent-soft);
  padding: 17px 18px;
  margin-top: 16px;
}
.rate-top {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}
.small-label {
  font-size: 9px;
  letter-spacing: 1.1px;
  color: var(--muted);
  font-weight: 700;
}
.mode-pill {
  font-size: 9px;
  line-height: 1.3;
  border: 1px solid var(--line);
  padding: 4px 7px;
  border-radius: 12px;
  max-width: 100%;
  color: var(--accent);
}
.exchange {
  font-size: 23px;
  letter-spacing: -0.5px;
  font-weight: 600;
  margin: 12px 0 6px;
  overflow-wrap: anywhere;
}
.rate-details {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}
.notice {
  font-size: 11px;
  line-height: 1.65;
  color: var(--muted);
  margin: 14px 4px 0;
  overflow-wrap: anywhere;
}
.notice.warning {
  color: var(--warning);
}
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 10px;
  color: var(--muted);
  padding: 25px 0 5px;
}
.footer-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
dialog {
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 25px 25px 0 0;
  max-width: 480px;
  width: 100%;
  max-height: 94dvh;
  margin: auto auto 0;
  padding: 24px 23px max(25px, env(safe-area-inset-bottom));
  overscroll-behavior: contain;
  overflow: auto;
}
dialog::backdrop {
  background: #071d2459;
  backdrop-filter: blur(3px);
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 22px;
}
.sheet-header .eyebrow {
  font-size: 9px;
  margin-bottom: 6px;
}
h2 {
  font-size: 28px;
  letter-spacing: -1px;
  margin: 0;
  font-weight: 650;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin: 16px 0;
}
.field input,
.field select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  padding: 14px 12px;
  font-size: 16px;
  min-height: 48px;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field-grid .field {
  font-size: 11px;
}
fieldset {
  padding: 0;
  margin: 18px 0;
  border: 0;
}
legend {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.mode-options {
  display: grid;
  gap: 7px;
}
.mode-options label {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 55px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
}
.mode-options input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  margin: 0;
  flex-shrink: 0;
}
.mode-options small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}
.mode-options label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cbr-panel {
  background: var(--accent-soft);
  border-radius: 13px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}
.cbr-panel strong {
  font-size: 18px;
  color: var(--text);
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  min-height: 44px;
  padding: 8px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.text-button:disabled {
  opacity: 0.5;
}
.form-hint {
  font-size: 11px;
  line-height: 1.65;
  color: var(--muted);
  margin: 17px 2px;
}
.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent);
  color: #fff;
  width: 100%;
  border: 0;
  border-radius: 14px;
  min-height: 53px;
  padding: 15px 19px;
  font-weight: 600;
  font-size: 15px;
  margin-top: 16px;
}
.primary-button span {
  font-size: 23px;
  font-weight: 400;
}
[hidden] {
  display: none !important;
}
noscript {
  display: block;
  text-align: center;
  padding: 30px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #14211e;
    --card: #1d2c27;
    --text: #eff4ee;
    --muted: #a1b3a7;
    --line: #35483e;
    --accent: #8bd3b5;
    --accent-soft: #223b31;
    --warning: #e6c487;
    --error: #ffb4ab;
  }
  :root:not([data-theme="light"]) .primary-button,
  :root:not([data-theme="light"]) .brand-mark {
    color: #10291e;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14211e;
  --card: #1d2c27;
  --text: #eff4ee;
  --muted: #a1b3a7;
  --line: #35483e;
  --accent: #8bd3b5;
  --accent-soft: #223b31;
  --warning: #e6c487;
  --error: #ffb4ab;
}
:root[data-theme="dark"] .primary-button,
:root[data-theme="dark"] .brand-mark {
  color: #10291e;
}
@media (max-width: 350px) {
  .app {
    padding-left: 17px;
    padding-right: 17px;
  }
  .intro {
    padding-top: 27px;
  }
  .calculator {
    padding: 20px;
  }
  .rate-card {
    padding: 15px;
  }
  .field-grid {
    gap: 8px;
  }
  .field-grid .field input {
    padding: 13px 9px;
    font-size: 16px;
  }
}
@media (min-height: 850px) {
  .intro {
    padding-top: 50px;
    padding-bottom: 35px;
  }
  .calculator {
    padding-top: 28px;
    padding-bottom: 30px;
  }
  .conversion-divider {
    margin-top: 24px;
    margin-bottom: 24px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  dialog[open] {
    animation: sheet-in 0.18s ease-out;
  }
  @keyframes sheet-in {
    from {
      transform: translateY(20px);
      opacity: 0.7;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
}
