/* Coin wallet dialog — above .coin-hud (5000), below .help-overlay (8000). */
.coin-wallet-overlay {
  position: fixed;
  inset: 0;
  z-index: 7500;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
}

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

.coin-wallet-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);
}

.coin-wallet-overlay__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  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(255, 209, 102, 0.35);
  border-right: 2px solid rgba(255, 209, 102, 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) {
  .coin-wallet-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(255, 209, 102, 0.35);
  }
}

.coin-wallet-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(255, 209, 102, 0.45);
  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;
}

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

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

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

.coin-wallet-overlay__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2.85rem 0.15rem 0.75rem;
  -webkit-overflow-scrolling: touch;
}

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

.coin-wallet-balance {
  text-align: center;
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(255, 230, 140, 0.95);
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
}

.coin-wallet-balance strong {
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
}

.coin-wallet-message {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.65rem;
  background: rgba(15, 41, 30, 0.55);
  border: 1px solid rgba(149, 213, 178, 0.28);
  font-size: max(0.9rem, 15px);
  color: rgba(241, 250, 238, 0.88);
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
  line-height: 1.4;
}

.coin-wallet-message[hidden] {
  display: none !important;
}

.coin-wallet-buy {
  display: block;
  width: 100%;
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #f4a261 0%, #e85d04 100%);
  color: #1a0f08;
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
  font-size: max(1rem, 16px);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.coin-wallet-buy:hover:not(:disabled) {
  filter: brightness(1.06);
}

.coin-wallet-buy:active:not(:disabled) {
  transform: scale(0.98);
}

.coin-wallet-buy:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.coin-wallet-buy:focus-visible {
  outline: 2px solid rgba(255, 230, 140, 0.9);
  outline-offset: 3px;
}

.coin-wallet-orders-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(255, 209, 102, 0.92);
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
}

.coin-wallet-orders {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.coin-wallet-orders__empty {
  margin: 0;
  padding: 0.75rem;
  text-align: center;
  font-size: max(0.95rem, 16px);
  color: rgba(216, 243, 220, 0.72);
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
}

.coin-wallet-order {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  background: rgba(15, 41, 30, 0.4);
  border-radius: 0.65rem;
  border: 1px solid rgba(149, 213, 178, 0.22);
  font-family: var(--font, "Fredoka", system-ui, sans-serif);
}

.coin-wallet-order__meta {
  flex: 1;
  min-width: 0;
}

.coin-wallet-order__date {
  display: block;
  font-size: max(0.82rem, 14px);
  color: rgba(216, 243, 220, 0.75);
}

.coin-wallet-order__status {
  display: block;
  font-size: max(0.78rem, 13px);
  color: rgba(255, 209, 102, 0.65);
  margin-top: 0.15rem;
}

.coin-wallet-order__coins {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ffe066;
  font-size: 1rem;
  white-space: nowrap;
}

.coin-wallet-order__price {
  font-size: max(0.82rem, 14px);
  color: rgba(241, 250, 238, 0.78);
  white-space: nowrap;
}
