/* overlay อยู่ชั้นล่างกว่า modal */
.coin-modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: none;
  z-index: 1000; /* เดิม 9999 ทำให้ทับ modal */
}

/* modal กลางจอ และชั้นบนกว่า overlay */
.coin-modal{
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, 92vw);
  max-height: 90vh;
  background: rgba(24, 10, 44, 0.5);
  backdrop-filter: blur(20px);
  color: #e5e7eb;
  border-radius: 16px;
  /*box-shadow: 0 20px 60px rgba(0,0,0,.35);*/
  display: none;
  overflow: hidden;
  z-index: 1001; /* สำคัญ: สูงกว่า overlay */
}

.first-time-tag {
  position: absolute;
  top: 0px;
  right: 0px;
  background: #facc15;
  color: #111;
  font-weight: 700;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 0 0 0 7px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  pointer-events: none;
}

.coin-modal header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #1f2937;
    background: linear-gradient(90deg, #3e195e 0%, #5b233e 100%);
}

.coin-modal h3 {
    margin: 0;
    font-size: 16px
}

.coin-modal .close {
    cursor: pointer;
    border: 0;
    background: transparent;
    color: #9ca3af;
    font-size: 18px
}

.coin-modal .body {
    padding: 16px;
    overflow: auto;
    max-height: calc(90vh - 52px)
}

.price-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px
}

.price-btn {
    padding: 12px 12px;
    padding-top:20px;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    color:#FFFFFF;
    position: relative;
    overflow: hidden;
    /*height:120px;*/
    /*padding-bottom: 0px;*/
}

.price-btn:hover {
    background: #363d4c;
    border-color: #64748b
}

.muted {
    color: #94a3b8;
    font-size: 12px;
    margin-top: 16px;
}

.step {
    display: none
}

.step.active {
    display: block
}

.iframe-wrap {
    border: 0;
    padding: 0;
    margin: 0
}

.iframe-wrap iframe {
    width: 100%;
    height: 68vh;
    border: 0;
    background: #0b0f19
}

.row {
    display: flex;
    gap: 8px;
    margin-top: 12px
}

.btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #e5e7eb;
    cursor: pointer
}

.btn.pri {
    background: #16a34a;
    border-color: #16a34a
}

.coins-info {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 0.25rem;
  padding: 0.375rem;
  font-size: 12px;
  margin-top: 10px;
}
.coins-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}
.total-row {
  border-top: 1px solid #475569;
  padding-top: 8px;
  margin-top: 5px;
}
.total-row .coins-value {
  color: #fbbf24;
  font-weight: bold;
  font-size: 12px;
}
.coins-label {
  color: #9ca3af;
}
.coins-value {
  color: white;
  font-weight: 600;
}
.bonus-row .coins-label {
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 2px;
}
.bonus-row .coins-value {
  color: #fbbf24;
}

/* ========== เพิ่มเฉพาะส่วน Animation ========== */
@keyframes coinOverlayFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes coinOverlayFadeOut { from { opacity: 1; } to { opacity: 0; } }

@keyframes coinModalIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.97); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes coinModalOut {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to   { opacity: 0; transform: translate(-50%, -50%) scale(0.97); }
}

.coin-overlay-fade-in  { animation: coinOverlayFadeIn .25s ease forwards; }
.coin-overlay-fade-out { animation: coinOverlayFadeOut .2s ease forwards; }
.coin-modal-zoom-in    { animation: coinModalIn .25s ease forwards; }
.coin-modal-zoom-out   { animation: coinModalOut .2s ease forwards; }
