
@layer patterns {
  
  .card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
    padding: var(--space-card);
    border: var(--border-width-card) solid var(--line-card-outlined);
    border-radius: var(--radius-card);
    background-color: var(--surface-card-outlined);
    box-shadow: var(--finish-panel-depth);
  }

  .card[data-main] {
    border-radius: var(--radius-card-main);
    box-shadow: var(--finish-panel-depth), var(--finish-hero-depth);
  }

  @media (max-width: 47.99rem) { 
    .card { padding: var(--space-4); }
  }

  .swap-stage {
    position: relative;
    isolation: isolate;
    width: 100%;
    max-width: var(--size-column-narrow);
    container-type: inline-size;
  }

  @container (max-width: 26rem) {
    .swap-stage .well-amount {
      font-size: var(--type-figure-xl);
      line-height: var(--leading-figure-xl);
    }
  }

  .swap-aura {
    position: absolute;
    z-index: -1;
    inset-block-start: calc(var(--space-4) * -1);
    inset-inline: calc(var(--space-4) * -1);
    block-size: min(60%, 24rem);
    border-radius: var(--radius-full);
    background-color: var(--accent);
    opacity: 0.22;
    filter: blur(var(--blur-glow));
    pointer-events: none;
  }

  .swap-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
  }

  .swap-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .well {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-4);
    overflow: hidden;
    border: var(--border-width) solid transparent;
    border-radius: var(--radius-card);
  }

  .well[data-tone="entry"] {
    border-color: var(--line-control);
    background-color: var(--surface-field);
  }

  .well[data-tone="entry"]::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-color: var(--surface-well-entry);
    pointer-events: none;
  }

  .well[data-tone="result"] {
    background-color: var(--surface-well);
  }

  .well-head,
  .well-body,
  .well-foot {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-3);
    min-width: 0;
  }

  .well-head { min-height: var(--size-chip); }

  .well-label {
    color: var(--text-muted);
    font-size: var(--type-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-medium);
  }

  .well-foot {
    min-height: var(--size-chip);
    color: var(--text-muted);
    font-size: var(--type-sm);
    line-height: var(--leading-sm);
  }

  .well-amount {
    flex: 1 1 7rem;
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-family: var(--font-figure);
    font-size: var(--type-figure-2xl);
    line-height: var(--leading-figure-2xl);
    font-weight: var(--weight-semibold);
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .well-amount .unit {
    margin-inline-end: var(--space-1);
    color: var(--text-muted);
    font-weight: var(--weight-medium);
  }

  .asset-pill {
    position: relative;
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--size-control-lg);
    max-inline-size: 100%;
    padding-block: var(--space-1);
    padding-inline: var(--space-1) var(--space-3);
    border: var(--border-width) solid var(--line);
    border-radius: var(--radius-pill);
    background-color: var(--surface-1);
    box-shadow: var(--finish-control);
    color: var(--text);
  }

  .asset-pill .coin {
    width: var(--size-avatar-lg);
    height: var(--size-avatar-lg);
  }

  .asset-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
  }

  .asset-symbol {
    font-size: var(--type-md);
    line-height: var(--leading-md);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
  }

  .asset-sub {
    max-inline-size: 9rem;
    overflow: hidden;
    color: var(--text-muted);
    font-size: var(--type-xs);
    line-height: var(--leading-xs);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .asset-caret {
    display: inline-flex;
    color: var(--text-muted);
  }

  .seam {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    height: 0;
  }

  .seam-switch {
    position: absolute;
    inset-block-start: calc(var(--size-control-md) / -2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--size-control-md);
    height: var(--size-control-md);
    border: var(--space-1) solid var(--surface-card-outlined);
    border-radius: var(--radius-control);
    background-color: var(--surface-2);
    box-shadow: var(--finish-control);
    color: var(--text);
  }

  .quote-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-height: var(--size-control-sm);
    color: var(--text-muted);
    font-size: var(--type-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-medium);
  }

  .cash-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4);
    border: var(--border-width) solid var(--line);
    border-radius: var(--radius-pill);
    background-color: var(--surface-1);
    box-shadow: var(--finish-panel-depth), var(--shadow-lg);
    white-space: nowrap;
  }

  .cash-word {
    color: var(--text-muted);
    font-size: var(--type-sm);
    line-height: var(--leading-sm);
  }

  .cash-figure {
    color: var(--text);
    font-size: var(--type-bar-figure);
    line-height: var(--leading-bar-figure);
    font-weight: var(--weight-semibold);
  }

  .cash-pill .icon-btn { pointer-events: none; }
}
