.loyalty {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--hairline);
}

.loyalty-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--gold-light);
  font-family: var(--display);
  font-size: 1.25rem;
  text-shadow: 0 1px 0 #000;
  line-height: 1;
}

.loyalty-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.loyalty-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.loyalty-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.05em;
  line-height: 1.15;
  text-transform: uppercase;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 #000;
}

.loyalty-boost {
  flex: none;
  color: var(--gold-light);
  font-family: var(--display);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 0 #000;
}

.loyalty.tier-guest .loyalty-boost {
  color: var(--muted);
}

.loyalty-bar {
  display: block;
  flex: 1 1 auto;
  min-width: 32px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.loyalty-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--magenta), var(--gold));
  transition: width 400ms ease-out;
}

.loyalty-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  column-gap: 10px;
  row-gap: 2px;
  min-width: 0;
}

.loyalty-next {
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  text-shadow: 0 1px 0 #000;
}

.loyalty-cash {
  display: flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000;
  white-space: nowrap;
}

.loyalty-cash-rate {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
}

.loyalty-cash.locked .loyalty-cash-rate {
  color: var(--muted);
}

.loyalty-cash-due {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--muted);
}

.loyalty-cash-due:empty {
  display: none;
}

.loyalty-cash-coins {
  color: var(--gold-light);
  font-variant-numeric: tabular-nums;
}

.loyalty-cash-coins.due {
  color: var(--gold);
}

.rank-loyalty {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}

.rank-loyalty-icon {
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--gold-light);
  line-height: 1;
}

.rank-loyalty-text {
  flex: 1;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.rank-loyalty-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}

.rank-loyalty-name {
  overflow: hidden;
  color: var(--gold);
  font-family: var(--display);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-loyalty-boost {
  color: var(--text);
  font-family: var(--display);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 #000;
}

.rank-loyalty-cash {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  font-family: var(--display);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000;
}

.rank-loyalty-cash-rate {
  color: var(--text);
}

.rank-loyalty-cash.locked .rank-loyalty-cash-rate {
  color: var(--muted);
}

.rank-loyalty-cash-due {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.rank-loyalty-cash-due:empty {
  display: none;
}

.rank-loyalty-next {
  flex: none;
  color: var(--muted);
  font: 600 .8125rem var(--body);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000;
}

.cabinet-bank {
  position: relative;
  display: grid;
  place-items: center;
}

.cabinet-bank-art {
  width: 30px;
  height: 30px;
  background: url("../art/lobby/bank.webp") center / contain no-repeat;
}

.cabinet-bank.bank-on::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--gold-light), var(--gold) calc(var(--bank-fill, 0) * 360deg), rgba(255, 255, 255, 0.16) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  pointer-events: none;
}

.cabinet-bank.bank-ready::after {
  filter: drop-shadow(0 0 3px var(--gold));
  animation: bank-ring 1.8s ease-in-out infinite;
  animation-play-state: var(--idle-play, running);
}

.level-up.bank-up {
  background: radial-gradient(circle at 50% 42%, rgba(214, 150, 40, 0.92), rgba(100, 18, 120, 0.94) 48%, rgba(14, 4, 34, 0.97) 76%);
}

.level-up-title.bank-title {
  font-size: 2.6rem;
  white-space: nowrap;
}

.bank-show-coins {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.bank-jar.big {
  position: relative;
  inset: auto;
  width: 200px;
  height: 200px;
}

.bank-shard.left {
  clip-path: polygon(0 0, 52% 0, 44% 22%, 56% 40%, 42% 60%, 54% 80%, 46% 100%, 0 100%);
}

.bank-shard.right {
  clip-path: polygon(52% 0, 100% 0, 100% 100%, 46% 100%, 54% 80%, 42% 60%, 56% 40%, 44% 22%);
}

.bank-crack {
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  background: #fff;
  box-shadow: 0 0 8px #fff;
  clip-path: polygon(51% 0, 54% 0, 46% 22%, 58% 40%, 44% 60%, 56% 80%, 48% 100%, 44% 100%, 52% 80%, 40% 60%, 54% 40%, 42% 22%);
  filter: drop-shadow(0 0 6px var(--gold-light));
  opacity: 0;
}

.bank-jar.big::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 56%;
  width: 104px;
  height: 104px;
  margin: -52px 0 0 -52px;
  background: url("../art/ui/coin-gold.webp") center / contain no-repeat;
  filter: drop-shadow(0 0 14px rgba(255, 212, 90, 0.9));
  opacity: 0;
  transform: scale(0.2);
}

.bank-stage::after {
  content: "";
  position: absolute;
  inset: -50px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, rgba(255, 240, 180, 0.7) 30%, transparent 65%);
  opacity: 0;
  pointer-events: none;
}

.bank-up.show .bank-jar.big {
  animation: bank-shake 700ms ease-in-out;
}

.bank-up.show .bank-crack {
  animation: bank-crack 700ms ease-in forwards;
}

.bank-up.cracked .bank-crack {
  animation: none;
  opacity: 0;
}

.bank-up.cracked .bank-shard.left {
  animation: bank-shard-left 600ms ease-out forwards;
}

.bank-up.cracked .bank-shard.right {
  animation: bank-shard-right 600ms ease-out forwards;
}

.bank-up.cracked .bank-jar.big::after {
  animation: bank-coin-pop 700ms cubic-bezier(0.2, 1.5, 0.4, 1) 120ms forwards;
}

.bank-up.cracked .bank-stage::after {
  animation: bank-burst 700ms ease-out forwards;
}

.bank-bonus-line {
  color: var(--gold-light);
  font-size: 0.88rem;
  font-family: var(--display);
  text-align: center;
  text-shadow: 0 1px 2px #000;
  animation: pearl-prize 300ms ease-out;
}

.level-up.tier-up {
  background: radial-gradient(circle at 50% 42%, var(--violet), var(--bg-deep) 72%);
}

.level-up-title.tier-up-title {
  font-size: 2.3rem;
  white-space: nowrap;
}

.level-up-stage.tier-up-stage {
  height: 150px;
}

.tier-up-mark {
  --c: var(--gold);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 132px;
  height: 132px;
  filter: drop-shadow(0 0 15px var(--c));
  animation: spire-gem-in 700ms cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

.tier-up-mark[data-tier="comet"] { --c: var(--neon-cyan); }
.tier-up-mark[data-tier="nova"] { --c: var(--gold); }
.tier-up-mark[data-tier="supernova"] { --c: var(--neon-pink); }
.tier-up-mark[data-tier="empress"] { --c: var(--gold-light); }

.tier-up-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tier-up-boost {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.tier-up-prize.bonus .spire-up-amount {
  color: var(--neon-pink);
}

.tier-up-prize .spire-up-label {
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.credits-coin.tier-up-coin {
  width: 60px;
  height: 60px;
}

.tier-up .pearl-collect {
  width: min(240px, 100%);
  color: var(--gold-ink);
  text-shadow: none;
}

@media (max-height: 700px) {
  .level-up-stage.tier-up-stage { height: 120px; }
  .tier-up-mark { width: 104px; height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  .tier-up-mark {
    animation: none;
  }
}

