:root {
  --cabinet-grand-ink: #ff7783;
  --cabinet-minor-ink: #83b8ff;
}


.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 6px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 50%),
    linear-gradient(180deg, var(--console-light), var(--navy-deep));
  border: 2px solid var(--gold-dark);
  box-shadow: 0 0 0 1px var(--gold-deep), 0 4px 10px rgba(0, 0, 0, 0.5);
}

.app > .topbar {
  min-height: 44px;
  padding-block: 0;
  border: 0;
  box-shadow: inset 0 0 0 2px var(--gold-dark), 0 0 0 1px var(--gold-deep), 0 3px 8px rgba(0, 0, 0, 0.5);
}

.app > .topbar .credits { padding-block: 0; }

.credits {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 2px 12px 2px 3px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.credits-coin {
  flex: none;
  width: 26px;
  height: 26px;
  background: url("../art/ui/coin-gold.webp") center / contain no-repeat;
}

/* The balance takes all the room the pill has, so its box doesn't change
   with the number: setFitText() shrinks the figures to that box, and a
   fit measured against a box that shrinks with its text never settles
   (Safari then cut it off as "22,1…"). Clipped, never an ellipsis: the
   balance always shows in full. */
.currency {
  flex: 1 1 0;
  min-width: 0;
  font-size: var(--type-readout);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.icon-button {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--gold-light);
  font-size: 1.1rem;
}


.tower {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 0 12px;
  overflow-x: visible;
  overflow-y: clip;
}

/* Everything in the tower. On a screen too short for it (Safari with its
   toolbars showing, say) render.js scales it down from the bottom. */
.tower-inner {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  transform-origin: 50% 100%;
}

.roof {
  position: relative;
  flex: none;
  z-index: 1;
  aspect-ratio: 1216 / 150;
  margin: 0 2px -43px;
  pointer-events: none;
}

.roof::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: url("../art/tower/crest.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

.roof::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 2;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  background: url("../art/nebula-empress/star-crystal.webp") center / contain no-repeat;
  filter: drop-shadow(0 0 4px rgba(255, 211, 77, 0.55));
}

.jackpots {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 12%;
  padding: 0 10px;
}

.jackpots .plaque-amount {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  text-align: center;
}

.jackpot.minor {
  justify-self: start;
  width: 90%;
  margin-left: -8px;
}

.jackpot.mini {
  justify-self: end;
  width: 90%;
  margin-right: -8px;
}

.plaque {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1px 6px 2px;
  border: 2px solid transparent;
  border-image: url("../art/tower/plaque.webp") 34 38 fill / 5px 6px stretch;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.6));
  line-height: 1.05;
}

.plaque-name {
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.jackpot.grand .plaque-name { background-image: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--cabinet-grand-ink); }
.jackpot.major .plaque-name { background-image: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--jp-major); }
.jackpot.minor .plaque-name { background-image: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--cabinet-minor-ink); }
.jackpot.mini .plaque-name { background-image: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--jp-mini); }

.plaque-amount {
  font-size: var(--type-readout);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  background-image: linear-gradient(180deg, #fff, #f2eeff 60%, #cfc4ff);
  filter: drop-shadow(0 1px 0 #1a0a30) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.8));
}

.jackpot.minor .plaque-amount,
.jackpot.mini .plaque-amount {
  font-size: 0.88rem;
}

.guardian {
  position: absolute;
  bottom: 34px;
  width: 64px;
  height: 150px;
  overflow: visible;
  filter: drop-shadow(0 0 1px #4a3000) drop-shadow(0 0 12px rgba(255, 190, 40, 0.6)) drop-shadow(0 0 18px rgba(255, 79, 216, 0.45)) drop-shadow(0 4px 4px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

.dragon-defs {
  position: absolute;
  width: 0;
  height: 0;
}

.guardian:not(.flip) {
  left: -4px;
}

.guardian.flip {
  right: -4px;
  transform: scaleX(-1);
}

.tower-inner:has(.meter.top.paying) .guardian {
  animation: guardian-pulse 520ms ease-in-out infinite alternate;
}

.meters {
  position: relative;
  z-index: 1;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: -24px 68px 0;
  padding: 0 6px 6px;
  --gate-inset: 9px -14px -2px;
}

.meters::before {
  content: "";
  position: absolute;
  inset: var(--gate-inset);
  z-index: -1;
  border-radius: 6px 6px 10px 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 211, 77, 0.45), 0 0 0 2px #1e0848, 0 0 14px rgba(200, 90, 255, 0.35), 0 4px 12px rgba(0, 0, 0, 0.6);
}

.gate-pillars {
  position: absolute;
  inset: var(--gate-inset);
  z-index: -1;
  pointer-events: none;
}

.gate-pillars::before,
.gate-pillars::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  background: url("../art/ui/tower-pillar.webp") center / 100% 100% no-repeat;
}

.gate-pillars::before { left: -2px; }
.gate-pillars::after { right: -2px; transform: scaleX(-1); }

.meter {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3px;
}

.meter::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -20px;
  right: -20px;
  z-index: -1;
  height: 22px;
  background: url("../art/ui/tower-eave.webp") center / 100% 100% no-repeat;
  pointer-events: none;
}

.meter-label {
  order: -1;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  margin-bottom: -6px;
  padding: 2px 18px 1px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 48%, rgba(0, 0, 0, 0.22)),
    linear-gradient(180deg, var(--c), var(--c-dark));
  box-shadow: inset 0 2px 0 var(--gold-light), inset 0 -2px 0 var(--gold-dark);
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%, 7px 50%);
  line-height: 1.1;
}

.meter-name {
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  background-image: linear-gradient(180deg, #fff, #fff 55%, #ffe4f6);
  filter: drop-shadow(0 1px 0 var(--c-dark)) drop-shadow(0 0 2px rgba(0, 0, 0, 0.9));
}

.meter.amber .meter-name {
  color: var(--bg-deep);
  background-image: none;
  filter: none;
  text-shadow: 0 1px 0 var(--gold-light);
}

.meter.top .meter-label {
  min-width: 122px;
  padding: 2px 20px 1px;
}

.meter.top .meter-name {
  font-size: 0.86rem;
  background-image: linear-gradient(180deg, #fff, #ffd6f5 50%, #ff8ae0);
}

.meter-slots {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 8px 8px 3px;
  border-radius: 8px;
}

.meter.full .meter-slots {
  box-shadow: 0 0 14px var(--c), inset 0 0 12px var(--c);
}

.slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid var(--c);
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.12), transparent 45%),
    radial-gradient(circle at 50% 55%, #070310 55%, var(--c-dark) 100%);
  box-shadow: 0 0 0 1.5px var(--gold-dark), 0 0 6px var(--c), inset 0 0 0 1.5px var(--c-light), inset 0 0 6px rgba(0, 0, 0, 0.9);
  color: #fff;
  font-family: var(--display);
  font-size: 0.75rem;
}

.slot.filled,
.cell.orb::before {
  background:
    conic-gradient(from 22.5deg, rgba(255, 255, 255, 0.4) 0 12.5%, transparent 0 25%, rgba(0, 0, 0, 0.18) 0 37.5%, transparent 0 50%, rgba(0, 0, 0, 0.28) 0 62.5%, transparent 0 75%, rgba(255, 255, 255, 0.22) 0 87.5%, transparent 0),
    radial-gradient(circle at 40% 32%, var(--c-light), var(--c) 50%, var(--c-dark));
}

.slot.filled {
  border-color: var(--gold);
  box-shadow: 0 0 0 1.5px var(--gold-deep), inset 0 0 0 1px var(--gold-light), 0 0 12px var(--c);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 2px #000;
}

.slot.landed {
  animation: slot-land 350ms ease-out;
}

.meter.lit {
  animation: meter-lit 600ms ease-out;
}

.meter.paying,
.plaque.paying {
  animation: paying 250ms steps(1) 5;
}

.plaque.paying.handpay {
  animation-duration: 1s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

.meters.fizzle .slot.filled {
  animation: fizzle 700ms ease-in forwards;
}

.tower-base {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: stretch;
  gap: 5px;
  margin-top: 5px;
}

.tower-sign,
.chests,
.spin-count {
  border-radius: 8px;
  background: linear-gradient(180deg, #1d1450, #090420);
  border: 2px solid var(--neon-pink);
  box-shadow: 0 0 0 1px var(--gold-dark), 0 0 10px rgba(255, 79, 216, 0.55), inset 0 0 8px rgba(255, 79, 216, 0.35);
}

.tower-sign {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  align-items: center;
  padding: 3px 5px;
}

.tower-sign > * {
  grid-area: 1 / 1;
  min-width: 0;
  color: #fff3cf;
  font-family: var(--display);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 1px 0 #000, 0 0 3px rgba(0, 0, 0, 0.8);
}

.tower-sign-fill {
  animation: sign-a 9s steps(1) infinite;
}

.tower-sign .chest-text {
  animation: sign-b 9s steps(1) infinite;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 1px;
  border-radius: 50%;
  vertical-align: -1px;
  background: radial-gradient(circle at 40% 35%, var(--c-light), var(--c) 50%, var(--c-dark));
  box-shadow: 0 0 0 1px var(--gold-dark);
}

.chest.chest-mini {
  width: 14px;
  height: 11px;
  border-width: 1px;
  border-radius: 50%;
  vertical-align: -2px;
  box-shadow: none;
}


.chests {
  flex: 1.3 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 3px 8px 4px;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 1px var(--gold-dark), 0 0 10px rgba(66, 230, 255, 0.5), inset 0 0 8px rgba(66, 230, 255, 0.3);
}

.chests-title {
  font-family: var(--display);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  background-image: var(--gold-bevel);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 var(--gold-deep)) drop-shadow(0 2px 1px rgba(0, 0, 0, 0.7));
}

.chest-bar {
  position: relative;
  height: 10px;
  border-radius: 2px;
  background: #241a48;
  box-shadow: 0 0 0 1px var(--gold-deep), inset 0 1px 2px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.chest-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 24 - 2px), #090420 calc(100% / 24 - 2px) calc(100% / 24));
}

.chest-bar.landed {
  animation: chest-bar-land 350ms ease-out;
}

.chests.full {
  border-color: var(--gold);
  animation: chests-full 600ms ease-in-out infinite alternate;
}

.chests.full .chests-title {
  background-image: linear-gradient(180deg, #fff, #fff);
}

.tower-base:has(.chests.full) .tower-sign-fill {
  display: none;
}

.tower-base:has(.chests.full) .chest-text {
  animation: none;
  color: #fff;
}

.chest-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 45%, var(--gold-dark));
  transition: width 300ms ease;
}

.spin-count {
  position: relative;
  isolation: isolate;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 2px 8px;
  font-family: var(--display);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.spin-count-label {
  color: var(--neon-cyan);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-shadow: 0 0 6px rgba(66, 230, 255, 0.8);
}

.spin-count-of {
  color: #fff;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 0 #000;
}

.spin-count strong {
  font-size: 1.4rem;
  background-image: linear-gradient(180deg, #fff, #fff 60%, #d8d8ff);
  filter: drop-shadow(0 1px 0 #1a0a30) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.8));
}

.spin-count.hot {
  border-color: var(--gold-light);
  background: radial-gradient(circle at 50% 45%, #7a2a00, #3a0a14 70%);
  animation: hot-box 700ms ease-in-out infinite alternate;
}

.spin-count.hot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 211, 77, 0.8) 0 10deg, transparent 10deg 24deg);
  -webkit-mask-image: radial-gradient(circle, #000 25%, transparent 68%);
  mask-image: radial-gradient(circle, #000 25%, transparent 68%);
  animation: rays 5s linear infinite;
  pointer-events: none;
}

.spin-count.hot strong {
  font-size: 1.5rem;
  background-image: var(--gold-bevel);
  filter: drop-shadow(0 0 1px #3a0a00) drop-shadow(0 2px 0 #3a0a00) drop-shadow(0 0 10px #ff8a00) drop-shadow(0 0 4px var(--gold));
}

.spin-count.hot .spin-count-label {
  position: absolute;
  visibility: hidden;
}

.spin-count.hot .spin-count-of {
  color: #fff;
  text-shadow: 0 0 6px var(--gold), 0 0 10px #ff8a00;
}

.spin-count.launch::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid var(--gold-light);
  border-radius: 9px;
  box-shadow: 0 0 16px var(--gold), inset 0 0 10px rgba(255, 211, 77, 0.8);
  opacity: 0;
  pointer-events: none;
  animation: spin-launch 600ms ease-out;
}

.spin-count.firing {
  animation: firing 700ms ease-out;
}

