/* The Arcade island's glass over the world (arcade/hud.js): the two counts while a tube is held, and the receipt. */

#ar-counts {
  position: fixed;
  z-index: 3;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--rim);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  pointer-events: none;
}

#ar-counts span {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 12px 2px 6px;
  border-radius: 999px;
  background: rgba(20, 14, 48, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

#ar-counts svg {
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

#ar-counts b {
  min-width: 2ch;
  font: 700 26px/1 "Courier New", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-align: right;
}

#ar-counts .haul {
  color: #ff3a4a;
  text-shadow: 0 0 6px rgba(255, 40, 60, 0.9), 0 0 14px rgba(255, 40, 60, 0.5);
}

#ar-counts .beat {
  color: #ffd23a;
  text-shadow: 0 0 6px rgba(255, 200, 40, 0.9), 0 0 14px rgba(255, 170, 0, 0.45);
}

#ar-counts.over .haul {
  animation: ar-throb 0.9s ease-in-out infinite alternate;
}

@keyframes ar-throb {
  to {
    text-shadow: 0 0 10px rgba(255, 60, 80, 1), 0 0 26px rgba(255, 60, 80, 0.8);
  }
}

/* The receipt: a strip of pink ticket paper torn off, the haul in red, its stubs, a crown stamp, the one line. */
#ar-receipt {
  position: fixed;
  z-index: 4;
  left: 50%;
  top: 22%;
  width: min(340px, 82vw);
  padding: 18px 20px 16px;
  transform: translateX(-50%) rotate(-2.5deg);
  background: linear-gradient(180deg, #ffe6f2, #ffc9e3);
  color: #5a1238;
  border-radius: 4px;
  box-shadow: 0 12px 30px rgba(40, 0, 40, 0.35), inset 0 0 0 2px rgba(255, 255, 255, 0.6);
  font: 700 16px/1.3 "Courier New", ui-monospace, monospace;
  text-align: center;
  pointer-events: none;
  -webkit-mask: radial-gradient(circle 7px at 50% 0, transparent 98%, #000) 0 0 / 20px 100% repeat-x;
  mask: radial-gradient(circle 7px at 50% 0, transparent 98%, #000) 0 0 / 20px 100% repeat-x;
}

#ar-receipt.tear {
  animation: ar-tear 3s ease-out both;
}

@keyframes ar-tear {
  0% {
    transform: translateX(-50%) translateY(30px) rotate(6deg) scale(0.8);
    opacity: 0;
  }
  10% {
    transform: translateX(-50%) rotate(-2.5deg);
    opacity: 1;
  }
  88% {
    transform: translateX(-50%) rotate(-2.5deg);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) translateY(-24px) rotate(-6deg);
    opacity: 0;
  }
}

#ar-receipt strong {
  display: block;
  font-size: 54px;
  line-height: 1;
  color: #e0102a;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
}

#ar-receipt .stubs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  margin: 10px 0 8px;
}

#ar-receipt .stubs i {
  width: 10px;
  height: 16px;
  border: 1.5px solid #a3245e;
  border-radius: 2px;
}

#ar-receipt .stubs i.ink {
  background: #a3245e;
}

#ar-receipt .stubs i.silver {
  background: linear-gradient(180deg, #ffffff, #9aa6b8);
}

#ar-receipt .stamp {
  position: absolute;
  right: 14px;
  top: 10px;
  width: 64px;
  height: 64px;
  transform: rotate(14deg);
  border: 3px solid #c58a00;
  border-radius: 50%;
  background: rgba(255, 220, 90, 0.35);
  animation: ar-stamp 0.35s 0.4s cubic-bezier(0.3, 1.8, 0.5, 1) both;
}

#ar-receipt .stamp svg {
  width: 100%;
  height: 100%;
}

@keyframes ar-stamp {
  from {
    transform: rotate(14deg) scale(2.2);
    opacity: 0;
  }
}

#ar-receipt p {
  margin: 0;
  font-size: 15px;
  font-style: italic;
}

@media (max-width: 700px) {
  #ar-counts {
    top: calc(14px + env(safe-area-inset-top));
  }
  #ar-counts b {
    font-size: 22px;
  }
  #ar-counts svg {
    width: 28px;
    height: 28px;
  }
}

/* A narrow screen: the name button holds the top left and the chat chip the top right, so the counts stand under
   them, in the middle, clear of the tickets under the chat chip. */
@media (max-width: 560px) {
  #ar-counts,
  :root[data-touch="true"] #ar-counts {
    top: calc(62px + env(safe-area-inset-top));
    gap: 6px;
    padding: 4px 6px;
  }
  #ar-counts span {
    padding: 2px 8px 2px 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #ar-receipt.tear,
  #ar-receipt .stamp,
  #ar-counts.over .haul {
    animation: none;
  }
}
