/* Valuta — прототип. Основа: токены design-system/tokens.css; здесь — то, что прототип добавляет сверху. */

/* Цифры — моноширинные из JetBrains Mono, всё остальное (₽ ₾ $ €, буквы) — из Inter.
   Так знак лари, которого нет в JetBrains Mono, выглядит так же, как остальные. */
@font-face {
  font-family: "Valuta Digits";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.woff2) format("woff2");
  unicode-range: U+0020, U+002B-002E, U+0030-003A, U+00A0, U+2009, U+202F, U+2212;
}

:root {
  --font-display: "Inter Tight", Inter, ui-sans-serif, system-ui, sans-serif;
  --font-text: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: "Valuta Digits", Inter, ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --glass: rgba(255, 255, 255, .66);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-line: rgba(255, 255, 255, .9);
  --float: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 40px 80px -40px rgba(53, 40, 160, .38), 0 18px 36px -24px rgba(22, 22, 27, .22);
  --lift: 0 24px 48px -32px rgba(53, 40, 160, .35), 0 6px 14px -10px rgba(22, 22, 27, .16);
  --globe-dot: rgba(85, 73, 200, .62);
  --globe-dot-back: rgba(85, 73, 200, .07);
  --globe-rim: rgba(85, 73, 200, .14);
  --grain-opacity: .035;
  --hero-glow: rgba(140, 126, 255, .16);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass: rgba(32, 31, 41, .62);
    --glass-strong: rgba(32, 31, 41, .9);
    --glass-line: rgba(255, 255, 255, .08);
    --float: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 40px 80px -40px rgba(0, 0, 0, .8), 0 18px 36px -24px rgba(0, 0, 0, .6);
    --lift: 0 24px 48px -32px rgba(0, 0, 0, .8), 0 6px 14px -10px rgba(0, 0, 0, .5);
    --globe-dot: rgba(170, 164, 240, .55);
    --globe-dot-back: rgba(170, 164, 240, .06);
    --globe-rim: rgba(170, 164, 240, .14);
    --grain-opacity: .05;
    --hero-glow: rgba(85, 73, 200, .28);
  }
}
:root[data-theme="dark"] {
  --glass: rgba(32, 31, 41, .62);
  --glass-strong: rgba(32, 31, 41, .9);
  --glass-line: rgba(255, 255, 255, .08);
  --float: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 40px 80px -40px rgba(0, 0, 0, .8), 0 18px 36px -24px rgba(0, 0, 0, .6);
  --lift: 0 24px 48px -32px rgba(0, 0, 0, .8), 0 6px 14px -10px rgba(0, 0, 0, .5);
  --globe-dot: rgba(170, 164, 240, .55);
  --globe-dot-back: rgba(170, 164, 240, .06);
  --globe-rim: rgba(170, 164, 240, .14);
  --grain-opacity: .05;
  --hero-glow: rgba(85, 73, 200, .28);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--font-text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); color: var(--accent-text); }
[hidden] { display: none !important; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--ink); color: var(--bg); border-radius: var(--radius-control); }
.skip:focus { top: 12px; }

.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.wrap { width: min(var(--container-wide), 100% - var(--gutter) * 2); margin-inline: auto; }
.wrap-narrow { width: min(var(--container), 100% - var(--gutter) * 2); margin-inline: auto; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .7; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Иконки — inline SVG, 1.6px линия, цвет из currentColor */
.i { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 14px; height: 14px; }
.i-lg { width: 22px; height: 22px; }

/* Кнопки */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--control-height); padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  font-size: 13px; font-weight: 650; letter-spacing: -.005em; white-space: nowrap;
  background: var(--paper); color: var(--ink); border-color: var(--line);
  transition: transform .25s var(--ease-out), background .2s, border-color .2s, box-shadow .25s var(--ease-out), color .2s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.btn:active { transform: translateY(0) scale(.985); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 10px 24px -12px rgba(85, 73, 200, .75); }
.btn-primary:hover { background: var(--accent-hover); border-color: transparent; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 16px 30px -12px rgba(85, 73, 200, .8); }
.btn-ink { background: var(--ink); color: var(--bg); border-color: transparent; }
.btn-ink:hover { border-color: transparent; opacity: .92; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); background: var(--inset); border-color: transparent; }
.btn-on-dark { background: var(--on-inverse); color: var(--inverse-raised); border-color: transparent; }
.btn-on-dark:hover { border-color: transparent; }
.btn-outline-dark { background: transparent; color: var(--on-inverse); border-color: var(--line-inverse); }
.btn-outline-dark:hover { border-color: rgba(255, 255, 255, .3); }
.btn-lg { min-height: 56px; padding: 0 26px; font-size: 15px; border-radius: 14px; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 12px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; border-radius: 12px; }
.btn .arrow { transition: transform .3s var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { .btn, .btn .arrow { transition: none; } .btn:hover { transform: none; } .btn:hover .arrow { transform: none; } }

/* Поля */
.field { position: relative; display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); transition: border-color .2s, box-shadow .2s; min-width: 0; }
.field:hover { border-color: var(--line-strong); }
.field:focus-within { border-color: var(--field-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.field > label, .field .label { font-size: 11px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea { all: unset; display: block; width: 100%; min-width: 0; font-size: 16px; color: var(--ink); }
.field textarea { min-height: 72px; white-space: pre-wrap; }
.field select { cursor: pointer; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field .hint { font-size: 11px; color: var(--muted); }
.field[data-invalid] { border-color: var(--danger); }
.field[data-invalid] .hint { color: var(--danger); }
.field-row { display: flex; align-items: center; gap: 10px; }
.field-row input { flex: 1; }
.field-big input { font-family: var(--font-num); font-size: 28px; font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.fields { display: grid; gap: 10px; }
.fields-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .fields-2 { grid-template-columns: 1fr; } }

.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: var(--muted); cursor: pointer; }
.check-row input { accent-color: var(--accent); width: 16px; height: 16px; margin: 1px 0 0; flex: 0 0 auto; }

/* Валютная кнопка с флагом */
.cur { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 999px; background: var(--inset); border: 1px solid var(--line); font-weight: 650; font-size: 13px; white-space: nowrap; transition: border-color .2s, background .2s; }
.cur:hover { border-color: var(--field-line); }
.cur select { all: unset; cursor: pointer; padding-right: 2px; }
.flag { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); background: var(--line); display: grid; }
.flag svg { width: 100%; height: 100%; }

/* Чипы и сегменты */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-size: 12px; font-weight: 550; color: var(--ink); transition: border-color .2s, background .2s, color .2s; }
.chip:hover { border-color: var(--line-strong); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[disabled] { color: var(--faint); border-style: dashed; pointer-events: none; }
.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 14px; background: var(--inset); border: 1px solid var(--line); }
.seg button { position: relative; z-index: 1; border: 0; background: transparent; padding: 9px 14px; border-radius: 10px; font-size: 12px; font-weight: 650; color: var(--muted); transition: color .25s; white-space: nowrap; }
.seg button[aria-pressed="true"] { color: var(--ink); }
.seg-thumb { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; border-radius: 10px; background: var(--paper); box-shadow: 0 1px 2px rgba(22, 22, 27, .08), 0 4px 12px -6px rgba(22, 22, 27, .2); transition: transform .4s var(--ease-out), width .4s var(--ease-out); }

/* Статусы */
.status { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 650; white-space: nowrap; background: var(--inset); color: var(--muted); border: 1px solid var(--line); line-height: 1.3; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.status-go { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.status-go::before { animation: pulse 1.6s ease-in-out infinite; }
.status-wait { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.status-ok { background: var(--success-soft); color: var(--success); border-color: transparent; }
.status-bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .status-go::before { animation: none; } }

/* Карточки */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; }
.card-pad { padding: 24px; }
.glass { background: var(--glass); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4); }

/* Тосты */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 13px; box-shadow: var(--lift); animation: toast-in .45s var(--ease-out); pointer-events: auto; }
.toast .i { color: var(--accent-on-inverse); }
@keyframes toast-in { from { transform: translateY(12px) scale(.98); opacity: 0; } }

/* Копирование */
.copy { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--accent-text); font-size: 12px; font-weight: 600; padding: 4px 6px; border-radius: 8px; }
.copy:hover { background: var(--accent-soft); }

/* Появление при загрузке: из видимого состояния, без ожидания прокрутки */
.rise { animation: rise .9s var(--ease-out) both; }
.rise-1 { animation-delay: .06s; } .rise-2 { animation-delay: .12s; } .rise-3 { animation-delay: .18s; } .rise-4 { animation-delay: .24s; } .rise-5 { animation-delay: .3s; }
@keyframes rise { from { transform: translateY(14px); opacity: .001; } }
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } html { scroll-behavior: auto; } }

/* Демо-полоса */
.demo-strip { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 16px; font-size: 11px; color: var(--on-inverse-muted); background: var(--inverse); text-align: center; }
.demo-strip b { color: var(--on-inverse); font-weight: 600; }
.demo-strip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-on-inverse); animation: pulse 2s infinite; }

/* Переходы между страницами (View Transitions API, где поддерживается) */
::view-transition-old(root) { animation: vt-out .22s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .5s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }

/* Иллюстрации-иконки: двухцветные SVG, работают в обеих темах */
.art { width: 72px; height: 72px; }
.art .bg { fill: var(--accent-soft); }
.art .ln { fill: none; stroke: var(--accent-text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.art .fill { fill: var(--accent); }
.art .acc { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
