.header-balance {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid var(--color-primary-border);
  border-radius: 12px;
  color: var(--text-white);
  background: linear-gradient(135deg, var(--ink-900-a95), var(--ink-800-a90));
  box-shadow: inset 0 1px 0 var(--white-a12), 0 0 18px var(--color-primary-faint);
  white-space: nowrap;
  text-decoration: none;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.header-balance::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(105deg, var(--transparent) 25%, var(--white-a06) 50%, var(--transparent) 75%);
  transform: translateX(-120%);
  transition: transform 500ms ease;
}

.header-balance:hover {
  border-color: var(--color-primary-border-strong);
  background: linear-gradient(135deg, var(--ink-800-a95), var(--color-primary-faint));
  box-shadow: inset 0 1px 0 var(--white-a12), 0 0 24px var(--color-primary-faint);
  transform: translateY(-1px);
}

.header-balance:hover::before { transform: translateX(120%); }

.header-balance:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.header-balance img {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  object-fit: contain;
  filter: drop-shadow(0 0 7px var(--color-primary-faint));
}

.header-balance strong {
  color: var(--text-white);
  font-family: var(--font-display);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.header-balance-denomination {
  color: var(--color-primary-light);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  line-height: 1;
}

.header-balance-copy { display: grid; gap: 4px; min-width: 0; }
.header-balance-value { display: flex; align-items: center; gap: 6px; min-width: 0; }
.header-balance-value strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.header-balance-buy { color: var(--color-primary-light); font: 600 10px/1.15 var(--font-body); }
.header-balance:hover .header-balance-buy { text-decoration: underline; text-underline-offset: 3px; }

@media (min-width: 861px) and (max-width: 1100px) {
  .header-balance {
    gap: 5px;
    min-height: 38px;
    padding: 6px 8px;
    border-radius: 10px;
  }

  .header-balance img {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  .header-balance strong { font-size: 13px; }
  .header-balance-denomination { font-size: 9px; }
}

@media (max-width: 860px) {
  .header-actions > .header-balance {
    display: inline-flex;
    min-height: 38px;
    gap: 5px;
    padding: 6px 9px;
    border-radius: 10px;
  }

  .header-actions > .header-balance img { width: 22px; height: 22px; flex-basis: 22px; }
  .header-actions > .header-balance strong { font-size: 13px; }
  .header-actions > .header-balance .header-balance-denomination { font-size: 9px; }
  .header-actions > .header-balance { max-width: 150px; }
  .header-actions > .header-balance .header-balance-buy { font-size: 9px; }
  .mobile-nav-drawer > .header-balance {
    display: none;
  }
}

@media (max-width: 380px) {
  .header-content { gap: 8px; }
  .header-content > nav { display: none; }
  .header-content .logo-brand { gap: 6px; }
  .header-content .logo-title { font-size: 15px; }
  .header-content .logo-subtitle { display: none; }
  .header-content .logo-icon-wrap,
  .header-content .logo-icon-wrap img { width: 32px; height: 32px; }
  .header-actions { gap: 8px; }
  .header-actions > .header-balance { max-width: 112px; padding: 6px; }
  .header-actions > .header-balance .header-balance-denomination { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .header-balance,
  .header-balance::before { transition: none; }
  .header-balance:hover { transform: none; }
  .header-balance:hover::before { transform: translateX(-120%); }
}

/* The balance is an action in the header, with the full amount kept readable. */
.header-actions .header-balance { flex: 0 0 auto; gap: 7px; min-height: 40px; max-width: none; padding: 7px 9px; border-radius: 10px; box-shadow: none; }
.header-actions .header-balance img { width: 23px; height: 23px; flex-basis: 23px; filter: none; }
.header-actions .header-balance strong { flex: 0 0 auto; font-size: 14px; white-space: nowrap; overflow: visible; text-overflow: clip; }
.header-actions .header-balance .header-balance-buy { display: none; }
.header-actions .header-balance .header-balance-copy { display: block; }
.header-actions .header-balance .header-balance-denomination { font-size: 9px; letter-spacing: .02em; }
.header-balance-add { display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 20px; border: 1px solid var(--color-primary-border); border-radius: 6px; color: var(--color-primary-light); background: var(--color-primary-subtle); font: 500 16px/1 var(--font-body); }
@media (max-width: 1279px) { .header-actions .header-balance .header-balance-denomination { display: none; } }
@media (max-width: 480px) { .header-actions .header-balance { gap: 5px; padding: 6px 7px; } .header-actions .header-balance strong { font-size: 12px; } .header-actions .header-balance img { width: 20px; height: 20px; flex-basis: 20px; } .header-balance-add { width: 18px; height: 18px; flex-basis: 18px; } }
