button.coin-hud {
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font: inherit;
  text-align: inherit;
  appearance: none;
}

button.coin-hud:focus-visible {
  outline: 2px solid rgba(255, 209, 102, 0.85);
  outline-offset: 2px;
}

.coin-hud {
  position: fixed;
  z-index: 5000;
  top: max(0.45rem, env(safe-area-inset-top, 0px));
  left: max(0.45rem, env(safe-area-inset-left, 0px));
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem 0.4rem 0.5rem;
  background: rgba(15, 41, 30, 0.92);
  border: 2px solid rgba(255, 209, 102, 0.45);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: max(1.05rem, 16px);
  font-weight: 700;
  color: #fefae0;
  line-height: 1;
}

/* Low balance: hint under the pill; left-aligned so wide boxes aren’t clipped off the left edge of the screen */
.coin-hud__tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 0.42rem);
  transform: none;
  z-index: 2;
  margin: 0;
  padding: 0.45rem 0.75rem;
  width: max-content;
  max-width: calc(
    100vw - max(0.45rem, env(safe-area-inset-left, 0px)) - env(safe-area-inset-right, 0px) - 0.65rem
  );
  box-sizing: border-box;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 209, 102, 0.5);
  background: rgba(15, 41, 30, 0.97);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  font-size: max(0.88rem, 14px);
  font-weight: 600;
  line-height: 1.35;
  color: rgba(255, 250, 224, 0.95);
  text-align: center;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.coin-hud--low-balance .coin-hud__tooltip {
  visibility: visible;
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: coin-hud-tooltip-appear 0.42s cubic-bezier(0.34, 1.35, 0.64, 1) both;
}

.coin-hud--low-balance .coin-hud__tooltip:focus-visible {
  outline: 2px solid rgba(255, 209, 102, 0.9);
  outline-offset: 2px;
}

@keyframes coin-hud-tooltip-appear {
  from {
    opacity: 0;
    transform: translateY(-0.35rem) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.coin-hud__icon {
  display: flex;
  flex-shrink: 0;
}

.coin-hud__icon svg {
  width: 1.45rem;
  height: 1.45rem;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.coin-hud__count {
  min-width: 1.25ch;
  font-variant-numeric: tabular-nums;
}

.coin-hud.coin-hud--counting {
  animation: coin-hud-count-pop 0.22s ease-out infinite alternate;
  border-color: rgba(255, 230, 140, 0.85);
}

@keyframes coin-hud-count-pop {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.06);
  }
}

/* Top-right cluster: gift scan (optional) + help menu — mirrors .coin-hud */
.app-hud-actions {
  position: fixed;
  z-index: 6001;
  top: max(0.45rem, env(safe-area-inset-top, 0px));
  right: max(0.45rem, env(safe-area-inset-right, 0px));
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  pointer-events: none;
}

.app-hud-actions > button {
  pointer-events: auto;
}

.app-hud-scan-gift {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  padding: 0;
  margin: 0;
  background: rgba(15, 41, 30, 0.92);
  border: 2px solid rgba(255, 209, 102, 0.45);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  font-family: "Fredoka", system-ui, sans-serif;
  color: #fefae0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.15s ease,
    transform 0.12s ease;
}

.app-hud-scan-gift:hover {
  border-color: rgba(255, 230, 140, 0.65);
}

.app-hud-scan-gift:active {
  transform: scale(0.96);
}

.app-hud-scan-gift:focus-visible {
  outline: 2px solid rgba(255, 209, 102, 0.85);
  outline-offset: 2px;
}

.app-hud-scan-gift__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
}

.app-hud-scan-gift__icon svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.app-hud-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.55rem;
  height: 2.55rem;
  padding: 0;
  margin: 0;
  background: rgba(15, 41, 30, 0.92);
  border: 2px solid rgba(255, 209, 102, 0.45);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  font-family: "Fredoka", system-ui, sans-serif;
  color: #fefae0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.15s ease,
    transform 0.12s ease;
}

.app-hud-menu:hover {
  border-color: rgba(255, 230, 140, 0.65);
}

.app-hud-menu:active {
  transform: scale(0.96);
}

.app-hud-menu:focus-visible {
  outline: 2px solid rgba(255, 209, 102, 0.85);
  outline-offset: 2px;
}

.app-hud-menu__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
}

.app-hud-menu__icon svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.app-hud-menu .app-hud-menu__icon--close {
  display: none;
}

.app-hud-menu.is-open .app-hud-menu__icon--menu {
  display: none;
}

.app-hud-menu.is-open .app-hud-menu__icon--close {
  display: flex;
}

/* Help overlay — same language as .dino-modal; above .app-hud-menu (6001) */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
}

.help-overlay[hidden] {
  display: none !important;
}

.help-overlay__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: rgba(5, 20, 14, 0.82);
  backdrop-filter: blur(6px);
}

.help-overlay__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  background: linear-gradient(
    165deg,
    var(--bg-card, #2d6a4f) 0%,
    var(--bg-deep, #0f291e) 100%
  );
  border-radius: 0;
  border-left: 2px solid rgba(149, 213, 178, 0.35);
  border-right: 2px solid rgba(149, 213, 178, 0.35);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.45);
  padding: max(0.85rem, env(safe-area-inset-top)) 1.15rem max(1.25rem, env(safe-area-inset-bottom));
  overflow: hidden;
}

@media (min-width: 540px) {
  .help-overlay__panel {
    margin-top: max(0.5rem, env(safe-area-inset-top));
    margin-bottom: max(0.5rem, env(safe-area-inset-bottom));
    min-height: calc(100vh - 1rem);
    min-height: calc(100dvh - 1rem);
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
    border-radius: 1.25rem;
    border: 2px solid rgba(149, 213, 178, 0.35);
  }
}

.help-overlay__close {
  position: absolute;
  top: max(0.5rem, env(safe-area-inset-top));
  right: max(0.5rem, env(safe-area-inset-right));
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 2px solid rgba(149, 213, 178, 0.4);
  background: rgba(15, 41, 30, 0.85);
  color: #fefae0;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
  padding: 0;
  z-index: 2;
  transition: background 0.15s ease, transform 0.12s ease;
}

.help-overlay__close:hover {
  background: rgba(45, 106, 79, 0.95);
}

.help-overlay__close:active {
  transform: scale(0.95);
}

.help-overlay__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2.85rem 0.25rem 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.help-overlay__title {
  margin: 0 0 1rem;
  font-size: clamp(1.35rem, 4.5vw, 1.65rem);
  font-weight: 700;
  color: #fefae0;
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
  text-align: center;
}

.help-overlay__section {
  margin-bottom: 1.35rem;
}

.help-overlay__section h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(255, 209, 102, 0.95);
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
}

.help-overlay__section p,
.help-overlay__section li {
  margin: 0;
  font-size: max(0.95rem, 16px);
  font-weight: 500;
  color: rgba(216, 243, 220, 0.92);
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
  line-height: 1.45;
}

.help-overlay__section p + p {
  margin-top: 0.55rem;
}

.help-overlay__section ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.help-overlay__section li + li {
  margin-top: 0.35rem;
}

.help-overlay__note {
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  background: rgba(15, 41, 30, 0.45);
  border-radius: 0.65rem;
  border: 1px solid rgba(149, 213, 178, 0.25);
  font-size: max(0.9rem, 15px) !important;
  color: rgba(241, 250, 238, 0.78) !important;
}

.help-overlay__table-wrap {
  margin-top: 0.5rem;
  overflow-x: auto;
  border-radius: 0.65rem;
  border: 1px solid rgba(149, 213, 178, 0.28);
}

.help-overlay__table {
  width: 100%;
  border-collapse: collapse;
  font-size: max(0.9rem, 15px);
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
}

.help-overlay__table th,
.help-overlay__table td {
  padding: 0.45rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid rgba(149, 213, 178, 0.2);
}

.help-overlay__table th {
  font-weight: 700;
  color: rgba(255, 209, 102, 0.9);
  background: rgba(15, 41, 30, 0.35);
}

.help-overlay__table td {
  color: rgba(216, 243, 220, 0.9);
}

.help-overlay__table tr:last-child th,
.help-overlay__table tr:last-child td {
  border-bottom: none;
}
