:root {
  --fondo: #fafafa;
  --card: #ffffff;
  --campo: #f4f4f5;
  --campo-su: #efeff1;
  --bordo: rgba(10, 10, 10, 0.07);
  --testo: #0a0a0a;
  --testo-2: #71717a;
  --testo-3: #a1a1aa;
  --accento: #3b5bfd;
  --accento-tenue: rgba(59, 91, 253, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.card {
  position: relative;
  width: min(380px, 100%);
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.04), 0 18px 40px -18px rgba(10, 10, 10, 0.16);
}

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2px 4px 12px;
}

.card__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card__brand {
  font-size: 12px;
  color: var(--testo-3);
  font-variation-settings: "wdth" 112;
  letter-spacing: 0.01em;
}

.rows {
  position: relative;
  display: grid;
  gap: 6px;
}

.row {
  position: relative;
  min-height: 92px;
  padding: 12px 14px 14px;
  background: var(--campo);
  border-radius: 18px;
  border: 1px solid transparent;
  transition: border-color 0.2s, background-color 0.2s;
}

.row.is-focus {
  background: var(--card);
  border-color: rgba(59, 91, 253, 0.45);
  box-shadow: 0 0 0 4px var(--accento-tenue);
}

.row__label {
  display: block;
  font-size: 12.5px;
  color: var(--testo-2);
  margin-bottom: 6px;
}

.row__slot {
  position: relative;
  height: 46px;
}

.amt {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
}

.amt__input {
  position: absolute;
  inset: 0 120px 0 0;
  width: auto;
  opacity: 0;
  border: 0;
  font: inherit;
  font-size: 32px;
  cursor: text;
  caret-color: transparent;
  background: transparent;
}

.amt__input[readonly] { cursor: default; }

.amt__num {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 1.2em;
  font-size: clamp(26px, 8.6vw, 32px);
  font-weight: 600;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  pointer-events: none;
}

.amt__num::before {
  content: "";
  position: absolute;
  inset: -2px -4px;
  border-radius: 6px;
  background: var(--accento-tenue);
  opacity: 0;
  transition: opacity 0.18s;
}

.amt.is-selected .amt__num::before { opacity: 1; }

.slot {
  position: relative;
  display: inline-block;
  height: 1.2em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent 0, #000 22%, #000 78%, transparent 100%);
  mask-image: linear-gradient(transparent 0, #000 22%, #000 78%, transparent 100%);
}

.slot--d { width: 1ch; }

.col {
  display: block;
  will-change: transform;
}

.col span,
.slot--s span {
  display: block;
  height: 1.2em;
  line-height: 1.2em;
  text-align: center;
}

.amt__caret {
  position: absolute;
  top: 50%;
  left: 0;
  width: 2px;
  height: 28px;
  margin-top: -14px;
  border-radius: 1px;
  background: var(--accento);
  opacity: 0;
  pointer-events: none;
}

.amt.is-typing .amt__caret {
  opacity: 1;
  animation: cursore 1.05s steps(1) infinite;
}

@keyframes cursore {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

.pill {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 9px 0 5px;
  border: 1px solid var(--bordo);
  border-radius: 999px;
  background: var(--card);
  color: var(--testo);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.06);
  transition: box-shadow 0.2s, background-color 0.2s;
}

.pill__sym {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accento-tenue);
  color: var(--accento);
  font-size: 13px;
  font-weight: 700;
}

.pill__code {
  display: inline-block;
  min-width: 2.4em;
}

.pill__chev {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--testo-2);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.pill[aria-expanded="true"] .pill__chev { transform: rotate(180deg); }
.pill.is-hover,
.pill[aria-expanded="true"] { box-shadow: 0 2px 8px rgba(10, 10, 10, 0.1); }

@media (hover: hover) {
  .pill:hover { box-shadow: 0 2px 8px rgba(10, 10, 10, 0.1); }
  .swap:hover { box-shadow: 0 6px 16px -4px rgba(10, 10, 10, 0.22); }
  .cta:hover { background: #1f1f23; }
  .menu__item:hover { color: var(--testo); }
}

.swap {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 4px solid var(--card);
  border-radius: 50%;
  background: var(--campo-su);
  color: var(--testo);
  cursor: pointer;
  box-shadow: 0 2px 6px -2px rgba(10, 10, 10, 0.14);
  transition: box-shadow 0.2s;
}

.swap.is-hover { box-shadow: 0 6px 16px -4px rgba(10, 10, 10, 0.22); }

.swap__icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 4px 12px;
  font-size: 12.5px;
  color: var(--testo-2);
}

.meta p { margin: 0; display: flex; align-items: center; white-space: nowrap; }

.rate { gap: 0; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.rate > span { display: inline-flex; }
.rate .rate__eq { margin: 0 0.35em; color: var(--testo-3); }
.rate > span + span { margin-left: 0.3em; }
.rate .rate__eq + span { margin-left: 0; }
.rate__num { color: var(--testo); font-weight: 550; }

.lock { gap: 6px; color: var(--testo-3); }

.lock__arc {
  width: 14px;
  height: 14px;
  transform: rotate(-90deg);
}

.lock__track,
.lock__ring {
  fill: none;
  stroke-width: 2;
}

.lock__track { stroke: rgba(10, 10, 10, 0.08); }

.lock__ring {
  stroke: var(--accento);
  stroke-linecap: round;
}

.lock__text { display: inline-flex; align-items: center; font-variant-numeric: tabular-nums; }
.lock__num { display: inline-flex; margin-left: 0.28em; }

.cta {
  display: block;
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 14px;
  background: var(--testo);
  color: #fafafa;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 6px 14px -8px rgba(10, 10, 10, 0.5);
  transition: background-color 0.2s;
}

.menu {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  width: 244px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 16px;
  box-shadow: 0 24px 48px -16px rgba(10, 10, 10, 0.24), 0 2px 6px rgba(10, 10, 10, 0.06);
  transform-origin: 85% 0%;
}

.menu[hidden] { display: none; }

.menu__hi {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 6px;
  height: 42px;
  border-radius: 11px;
  background: var(--campo);
  opacity: 0;
  pointer-events: none;
}

.menu__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  padding: 0 10px 0 8px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  color: var(--testo);
  text-align: left;
  cursor: pointer;
  border-radius: 11px;
}

.menu__item .pill__sym { width: 26px; height: 26px; }
.menu__code { font-weight: 600; width: 2.6em; }
.menu__name { flex: 1; color: var(--testo-2); white-space: nowrap; }

.menu__check {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--accento);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.menu__item[aria-selected="true"] .menu__check { opacity: 1; }
.menu__item[aria-disabled="true"] { color: var(--testo-3); cursor: default; }
.menu__item[aria-disabled="true"] .menu__name { color: var(--testo-3); }

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  width: 22px;
  height: 22px;
  fill: #0a0a0a;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.22));
}

@media (max-width: 420px) {
  .card { padding: 12px; border-radius: 22px; }
  .card__head { padding-bottom: 8px; }
  .row { min-height: 82px; padding: 10px 12px 12px; }
  .row__label { margin-bottom: 4px; }
  .meta { padding: 10px 2px; font-size: 11.5px; }
  .cta { height: 42px; }
  .menu { width: 232px; }
}

@media (max-height: 460px) {
  .card__head { padding-bottom: 6px; }
  .row { min-height: 78px; padding-top: 8px; padding-bottom: 10px; }
  .meta { padding: 8px 2px; }
  .cta { height: 40px; }
}
