/* TX Arena accounts (docs/specs/auth-presence.md §4.1, §4.2): the nav pill, the menu link, avatars, sync dots and
   the "Save your progress" dialog. Tokens come from base.css (rgb(var(--x))). Containers owned elsewhere: the nav
   slot .ax-auth (axiom shell) and the menu wrapper .gm-auth (game.css). */

/* ---------------------------------------------------------------------------------------------------------
   Entries (4.1)
   --------------------------------------------------------------------------------------------------------- */
.txa-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.txa-entry[hidden] {
  display: none !important;
}

/* nav pill */
.txa-nav-btn {
  height: 32px;
  padding: 0 12px 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  max-width: 190px;
  border-radius: 999px;
  border: 1px solid rgb(var(--primary-stroke));
  background: transparent;
  color: rgb(var(--text-primary));
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s;
}
.txa-nav-btn:hover {
  background: rgb(var(--background-secondary));
  border-color: rgb(var(--secondary-stroke));
}
.txa-nav-btn > i {
  font-size: 15px;
  color: rgb(var(--text-secondary));
}
.txa-nav-btn.on {
  padding: 0 11px 0 4px;
}
.txa-nav-name {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* menu link */
.txa-link {
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  color: rgb(var(--text-secondary));
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  transition: color 0.12s, background-color 0.12s;
}
.txa-link.txa-out {
  color: rgb(var(--text-tertiary));
}
.txa-link:hover,
.txa-link.txa-out:hover {
  color: rgb(var(--text-primary));
  background: rgb(var(--background-secondary));
}
.txa-link > i {
  font-size: 15px;
}
.txa-menu-name {
  color: rgb(var(--text-primary));
  font-weight: 600;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.txa-nav-btn:focus-visible,
.txa-link:focus-visible {
  outline: 2px solid rgb(var(--primary-color));
  outline-offset: 2px;
}

/* avatar: hue from the name (inline --txa-h), default 220 */
.txa-av {
  --txa-h: 220;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: hsl(var(--txa-h) 38% 30%);
  color: hsl(var(--txa-h) 70% 88%);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  user-select: none;
}
.txa-av i {
  font-size: 13px;
  color: inherit;
}
.txa-av.sm {
  width: 18px;
  height: 18px;
  font-size: 10px;
}
.txa-av.sm i {
  font-size: 11px;
}
.txa-av.lg {
  width: 40px;
  height: 40px;
  font-size: 17px;
}
.txa-av.lg i {
  font-size: 19px;
}

/* sync dot: green (saved) by default */
.txa-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.85;
  background: rgb(var(--increase));
}
.txa-dot.is-idle {
  background: rgb(var(--text-tertiary));
}
.txa-dot.is-saving,
.txa-dot.is-waiting {
  background: rgb(var(--primary-color));
  animation: txa-pulse 1s ease-in-out infinite;
}
.txa-dot.is-offline,
.txa-dot.is-error {
  background: rgb(var(--primary-yellow));
}
@keyframes txa-pulse {
  50% {
    opacity: 0.35;
  }
}

/* ---------------------------------------------------------------------------------------------------------
   Dialog (4.2)
   --------------------------------------------------------------------------------------------------------- */
.txa-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(0 0 0 / 0.62);
  animation: txa-fade 0.14s ease-out;
}
@keyframes txa-fade {
  from {
    opacity: 0;
  }
}
.txa-card {
  position: relative;
  width: min(392px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: rgb(var(--background-secondary));
  border: 1px solid rgb(var(--primary-stroke));
  border-radius: 12px;
  padding: 24px 24px 16px;
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.55);
  color: rgb(var(--text-primary));
  font-family: var(--font-ax);
  font-size: 13px;
  animation: txa-rise 0.16s ease-out;
}
@keyframes txa-rise {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
}

.txa-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: rgb(var(--text-tertiary));
  font-size: 18px;
}
.txa-x:hover {
  color: rgb(var(--text-primary));
  background: rgb(var(--background-tertiary));
}

/* head */
.txa-head h2 {
  margin: 0 32px 4px 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.txa-sub {
  margin: 0 0 16px;
  color: rgb(var(--text-secondary));
  line-height: 1.45;
}

/* tabs */
.txa-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: var(--ax-bg);
  border: 1px solid rgb(var(--border-subtle));
}
.txa-tab {
  height: 30px;
  border-radius: 6px;
  color: rgb(var(--text-secondary));
  font-weight: 600;
  transition: color 0.12s, background-color 0.12s;
}
.txa-tab:hover {
  color: rgb(var(--text-primary));
}
.txa-tab.on {
  background: rgb(var(--background-tertiary));
  color: rgb(var(--text-primary));
  box-shadow: inset 0 0 0 1px rgb(var(--secondary-stroke));
}

/* form */
.txa-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.txa-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.txa-label {
  font-size: 12px;
  color: rgb(var(--text-secondary));
}
.txa-hint {
  font-size: 12px;
  color: rgb(var(--text-tertiary));
}
.txa-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  outline: none;
  background: var(--ax-bg);
  border: 1px solid rgb(var(--secondary-stroke));
  color: rgb(var(--text-primary));
  font-size: 14px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.txa-input::placeholder {
  color: rgb(var(--text-tertiary));
}
.txa-input:focus {
  border-color: rgb(var(--primary-color));
  box-shadow: 0 0 0 3px rgb(var(--primary-color) / 0.16);
}
.txa-input.sm {
  height: 32px;
  font-size: 13px;
  flex: 1 1 auto;
  min-width: 0;
}
.txa-pw {
  position: relative;
  display: flex;
}
.txa-pw .txa-input {
  padding-right: 40px;
}
.txa-eye {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: rgb(var(--text-tertiary));
  font-size: 16px;
}
.txa-eye:hover {
  color: rgb(var(--text-primary));
}

/* error box */
.txa-err {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgb(var(--decrease) / 0.1);
  color: rgb(var(--decrease-hover));
  line-height: 1.4;
}
.txa-err[hidden] {
  display: none;
}
.txa-rows + .txa-err {
  margin-top: 12px;
}

/* primary button + spinner */
.txa-primary {
  height: 40px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgb(var(--primary-color));
  color: #0b0b0f;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.12s, opacity 0.12s;
}
.txa-primary:hover {
  background: rgb(var(--primary-color-hover));
}
.txa-spin {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: txa-spin 0.7s linear infinite;
}
@keyframes txa-spin {
  to {
    transform: rotate(360deg);
  }
}

/* "or sign in with a wallet" */
.txa-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
  color: rgb(var(--text-tertiary));
  font-size: 12px;
}
.txa-or::before,
.txa-or::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: rgb(var(--primary-stroke));
}

/* wallet grid */
.txa-wallets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.txa-wbtn {
  height: 40px;
  padding: 0 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgb(var(--secondary-stroke));
  background: rgb(var(--background-tertiary) / 0.5);
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.12s, border-color 0.12s, opacity 0.12s, box-shadow 0.12s;
}
.txa-wbtn:hover {
  background: rgb(var(--background-tertiary));
  border-color: rgb(var(--text-tertiary));
}
.txa-wbtn.missing {
  opacity: 0.55;
}
.txa-wbtn.missing:hover {
  opacity: 0.8;
}
.txa-wbtn.pending {
  border-color: rgb(var(--primary-color));
  box-shadow: 0 0 0 3px rgb(var(--primary-color) / 0.14);
}
.txa-wicon {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  flex-shrink: 0;
}
.txa-wglyph {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: rgb(var(--secondary-stroke));
  color: rgb(var(--text-secondary));
  font-size: 12px;
}
.txa-wname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.txa-wmiss {
  display: none;
}

/* wallet status note, notes, footer */
.txa-pending {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgb(var(--primary-color) / 0.1);
  color: rgb(var(--text-primary));
  line-height: 1.4;
}
.txa-note {
  display: flex;
  gap: 8px;
  margin: 12px 0 0;
  color: rgb(var(--text-tertiary));
  font-size: 12px;
  line-height: 1.45;
}
.txa-note i {
  font-size: 13px;
  margin-top: 1px;
}
.txa-note.tight {
  margin-top: 8px;
}
.txa-foot {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px -24px 0;
  padding: 12px 24px 0;
  border-top: 1px solid rgb(var(--border-subtle));
  color: rgb(var(--text-tertiary));
  font-size: 12px;
  line-height: 1.45;
}
.txa-foot i {
  font-size: 13px;
  margin-top: 1px;
}

/* account head */
.txa-acct {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 32px 16px 0;
}
.txa-acct-txt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.txa-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.txa-sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgb(var(--text-secondary));
  font-size: 12px;
}
.txa-sync.is-error,
.txa-sync.is-offline {
  color: rgb(var(--primary-yellow));
}

/* account rows */
.txa-rows {
  border: 1px solid rgb(var(--primary-stroke));
  border-radius: 10px;
  overflow: hidden;
}
.txa-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 16px;
}
.txa-rows > * + * {
  border-top: 1px solid rgb(var(--border-subtle));
}
.txa-rlabel {
  width: 72px;
  flex-shrink: 0;
  color: rgb(var(--text-secondary));
}
.txa-rval {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.txa-dim {
  color: rgb(var(--text-tertiary));
}
.txa-act {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  flex-shrink: 0;
  color: rgb(var(--primary-color));
  font-weight: 600;
  transition: background-color 0.12s, color 0.12s;
}
.txa-act:hover {
  background: rgb(var(--primary-color) / 0.1);
  color: rgb(var(--primary-color-hover));
}
.txa-act.primary {
  background: rgb(var(--primary-color));
  color: #0b0b0f;
}
.txa-act.primary:hover {
  background: rgb(var(--primary-color-hover));
  color: #0b0b0f;
}
.txa-row.txa-editrow {
  gap: 8px;
}
.txa-sub-box {
  padding: 12px 12px 16px;
  background: rgb(0 0 0 / 0.18);
}
.txa-sub-box .txa-wbtn {
  padding: 0 6px;
  gap: 6px;
}

/* actions */
.txa-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.txa-err:not([hidden]) + .txa-actions {
  margin-top: 12px;
}
.txa-secondary,
.txa-ghost {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.txa-secondary i,
.txa-ghost i {
  font-size: 15px;
}
.txa-secondary {
  flex: 1 1 auto;
  border: 1px solid rgb(var(--secondary-stroke));
  color: rgb(var(--text-primary));
}
.txa-secondary:hover {
  background: rgb(var(--background-tertiary));
}
.txa-ghost {
  color: rgb(var(--text-secondary));
}
.txa-ghost:hover {
  color: rgb(var(--text-primary));
  background: rgb(var(--background-tertiary));
}

/* focus rings (inputs show focus through their border + ring) */
.txa-primary:focus-visible,
.txa-secondary:focus-visible,
.txa-ghost:focus-visible,
.txa-wbtn:focus-visible,
.txa-tab:focus-visible,
.txa-act:focus-visible,
.txa-x:focus-visible,
.txa-eye:focus-visible {
  outline: 2px solid rgb(var(--primary-color));
  outline-offset: 2px;
}

/* busy card: every control disabled; tabs and non-pending wallets dimmed */
.txa-card.busy .txa-wbtn:not(.pending),
.txa-card.busy .txa-tab {
  opacity: 0.5;
}
.txa-card.busy .txa-primary {
  opacity: 0.8;
  cursor: progress;
}
/* page-wide side effect, as in the original */
button:disabled {
  cursor: default;
}

@media (max-width: 420px) {
  .txa-card {
    padding: 20px 16px 12px;
  }
  .txa-foot {
    margin: 16px -16px 0;
    padding: 12px 16px 0;
  }
  .txa-wallets {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .txa-backdrop,
  .txa-card,
  .txa-dot,
  .txa-spin {
    animation: none;
  }
}
