/* =========================================================
   Tournament Site — Withdraw ZORC (floating button + panel)
   Loaded on every player page after styles.css / home.css.
   Uses the same tokens (--panel, --border, --gold ...).
   ========================================================= */

/* ---------- Floating button (bottom-right, PC + mobile) ---------- */

.wd-fab {
  position: fixed;
  right: 16px;
  /* Sit above the mobile bottom nav; flush corner on desktop */
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  height: 52px;
  /* Stack gap used by Help FAB above this button */
  --fab-stack-gap: 14px;
  padding: 0 20px 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-raised);
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(232, 184, 75, 0.35), 0 8px 20px rgba(0, 0, 0, 0.45);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.wd-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 18px rgba(232, 184, 75, 0.65), 0 10px 24px rgba(0, 0, 0, 0.5);
}

.wd-fab:active {
  transform: scale(0.96);
}

.wd-fab svg {
  width: 22px;
  height: 22px;
  flex: none;
  stroke: currentColor;
  fill: none;
}

.wd-fab__dot {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--crimson);
  border: 2px solid var(--panel-raised);
}

.wd-fab__dot[hidden] {
  display: none;
}

html.wd-open body,
html.wd-warn-open body {
  overflow: hidden;
}

/* ---------- Withdraw warning popup (before form) ---------- */

.wd-warn-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(4, 5, 10, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: wd-warn-backdrop-in 0.25s ease-out;
}

.wd-warn-overlay[hidden] {
  display: none;
}

@keyframes wd-warn-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.wd-warn-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 28px 24px 24px;
  border-radius: 16px;
  background: linear-gradient(165deg, #1a1218 0%, #0e0c12 55%, #160e14 100%);
  border: 1.5px solid rgba(255, 80, 100, 0.65);
  box-shadow:
    0 0 0 1px rgba(255, 200, 80, 0.15),
    0 0 24px rgba(232, 40, 63, 0.45),
    0 0 48px rgba(232, 184, 75, 0.25),
    0 16px 40px rgba(0, 0, 0, 0.65);
  text-align: center;
  overflow: hidden;
  animation: wd-warn-card-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes wd-warn-card-in {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Pulsing light ring behind the card */
.wd-warn-card__glow {
  pointer-events: none;
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 50% 30%, rgba(232, 40, 63, 0.35) 0%, transparent 55%),
    radial-gradient(circle at 50% 70%, rgba(232, 184, 75, 0.28) 0%, transparent 50%);
  animation: wd-warn-pulse 1.8s ease-in-out infinite;
  z-index: 0;
}

@keyframes wd-warn-pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.wd-warn-card__icon,
.wd-warn-card__title,
.wd-warn-card__text,
.wd-warn-card__hint,
.wd-warn-card__btn {
  position: relative;
  z-index: 1;
}

.wd-warn-card__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffd666;
  background: rgba(232, 40, 63, 0.18);
  border: 1px solid rgba(255, 200, 80, 0.5);
  box-shadow:
    0 0 16px rgba(232, 40, 63, 0.55),
    0 0 28px rgba(232, 184, 75, 0.35);
  animation: wd-warn-icon-glow 1.6s ease-in-out infinite;
}

.wd-warn-card__icon svg {
  width: 28px;
  height: 28px;
}

@keyframes wd-warn-icon-glow {
  0%,
  100% {
    box-shadow:
      0 0 12px rgba(232, 40, 63, 0.45),
      0 0 20px rgba(232, 184, 75, 0.25);
  }
  50% {
    box-shadow:
      0 0 22px rgba(232, 40, 63, 0.85),
      0 0 40px rgba(232, 184, 75, 0.55);
  }
}

.wd-warn-card__title {
  margin: 0 0 14px;
  font-family: var(--font-display, inherit);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ffe8a8;
  text-shadow: 0 0 12px rgba(232, 184, 75, 0.55);
}

.wd-warn-card__text {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.55;
  font-weight: 600;
  color: #fff5f5;
}

.wd-warn-card__text--en {
  color: #ffc9d0;
  text-shadow: 0 0 8px rgba(232, 40, 63, 0.35);
}

.wd-warn-card__text--bn {
  font-size: 16px;
  color: #ffe9a0;
  text-shadow: 0 0 10px rgba(232, 184, 75, 0.4);
  margin-bottom: 12px;
}

.wd-warn-card__hint {
  margin: 0 0 18px;
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
}

.wd-warn-card__btn {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-display, inherit);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1a0e10;
  background: linear-gradient(135deg, #ffd666 0%, #e8b84b 45%, #f07178 100%);
  box-shadow:
    0 0 18px rgba(232, 184, 75, 0.55),
    0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.wd-warn-card__btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 28px rgba(232, 184, 75, 0.75),
    0 6px 18px rgba(0, 0, 0, 0.4);
}

.wd-warn-card__btn:active {
  transform: scale(0.98);
}

.wd-warn-card--shake {
  animation: wd-warn-shake 0.4s ease;
}

@keyframes wd-warn-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(5px);
  }
}

/* ---------- Panel ---------- */

.wd-overlay {
  position: fixed;
  inset: 0;
  z-index: 115;
  background: rgba(5, 6, 9, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.wd-overlay[hidden] {
  display: none;
}

.wd-modal {
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: var(--radius-clip);
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 0 10px rgba(232, 184, 75, 0.3), 0 0 28px rgba(232, 184, 75, 0.14);
}

.wd-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wd-modal__title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0;
}

.wd-modal__close {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.wd-modal__close:hover {
  color: var(--crimson);
  border-color: var(--crimson-dim);
}

.wd-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-clip);
  padding: 12px 14px;
  font-size: 13px;
}

.wd-balance__label {
  color: var(--text-muted);
}

.wd-balance__value {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--gold);
}

.wd-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

.wd-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wd-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wd-field label {
  font-size: 12px;
  color: var(--text-muted);
}

.wd-field input,
.wd-field select {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-clip);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px; /* stops iOS zoom-on-focus */
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

.wd-field input:focus,
.wd-field select:focus {
  border-color: var(--gold);
}

.wd-message {
  margin: 0;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.5;
  border-radius: var(--radius-clip);
  border: 1px solid var(--border);
}

.wd-message[hidden] {
  display: none;
}

.wd-message--ok {
  color: var(--success);
  border-color: var(--success);
  background: rgba(61, 220, 132, 0.08);
}

.wd-message--error {
  color: var(--text-primary);
  border-color: var(--crimson-dim);
  background: rgba(232, 40, 63, 0.08);
}

.wd-submit {
  width: 100%;
}

.wd-list-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin: 6px 0 0;
}

.wd-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wd-empty {
  font-size: 13px;
  color: var(--text-muted);
}

.wd-item {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-clip);
  padding: 12px 14px;
}

.wd-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wd-item__amount {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.wd-item__status {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-clip);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.wd-item--pending .wd-item__status { color: var(--gold); border-color: var(--gold); }
.wd-item--approved .wd-item__status { color: var(--success); border-color: var(--success); }
.wd-item--rejected .wd-item__status,
.wd-item--canceled .wd-item__status { color: var(--crimson); border-color: var(--crimson-dim); }

.wd-item__meta {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.wd-item__note {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
}

/* ---------- Mobile ---------- */

@media (max-width: 860px) {
  /* sit above the fixed bottom tab bar and the phone's home indicator */
  .wd-fab {
    right: 14px;
    bottom: calc(var(--nav-height-mobile, 68px) + 14px + env(safe-area-inset-bottom));
    height: 48px;
    padding: 0 16px 0 14px;
  }

  /* Match Withdraw’s bottom, then + height + gap so they never overlap */
  .hs-fab {
    right: 14px;
    bottom: calc(var(--nav-height-mobile, 68px) + 14px + 48px + 14px + env(safe-area-inset-bottom));
    height: 48px;
    padding: 0 14px 0 12px;
    font-size: 13px;
  }

  /* bottom sheet */
  .wd-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .wd-modal {
    max-width: none;
    max-height: 90vh;
    max-height: 90dvh;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 480px) {
  /* icon-only round button on small phones */
  .wd-fab {
    width: 52px;
    height: 52px;
    padding: 0;
    justify-content: center;
  }

  .wd-fab__label {
    display: none;
  }

  .wd-fab__dot {
    top: 0;
    right: 0;
  }
}

/* Desktop / wide screens — classic bottom-right corner */
@media (min-width: 900px) {
  .wd-fab {
    right: 22px;
    bottom: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wd-fab { transition: none; }
}

/* ---------- Help & Support FAB (above Withdraw) ---------- */

.hs-fab {
  position: fixed;
  right: 16px;
  /* Withdraw bottom (72) + Withdraw height (52) + clear gap (14) */
  bottom: calc(72px + 52px + 14px + env(safe-area-inset-bottom, 0px));
  z-index: 91;
  height: 52px;
  padding: 0 20px 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-raised);
  color: var(--cyan, #3fe0d0);
  border: 1px solid var(--cyan, #3fe0d0);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(63, 224, 208, 0.3), 0 8px 20px rgba(0, 0, 0, 0.45);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.hs-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 18px rgba(63, 224, 208, 0.55), 0 10px 24px rgba(0, 0, 0, 0.5);
}

.hs-fab:active {
  transform: scale(0.96);
}

.hs-fab svg {
  width: 22px;
  height: 22px;
  flex: none;
  stroke: currentColor;
  fill: none;
}

html.hs-open body {
  overflow: hidden;
}

.hs-overlay {
  position: fixed;
  inset: 0;
  z-index: 125;
  background: rgba(4, 5, 10, 0.82);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.hs-overlay[hidden] {
  display: none;
}

.hs-panel {
  width: 100%;
  max-width: 420px;
  max-height: min(78vh, 560px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px 16px 12px 12px;
  padding: 18px 18px 22px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.55);
}

.hs-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.hs-panel__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.hs-panel__close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.hs-panel__close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
}

.hs-warn {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(232, 184, 75, 0.45);
  background: linear-gradient(135deg, rgba(232, 184, 75, 0.12), rgba(20, 16, 8, 0.9));
  box-shadow: 0 0 16px rgba(232, 184, 75, 0.2);
}

.hs-warn__en {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #ffe9a0;
  line-height: 1.4;
}

.hs-warn__bn {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 240, 200, 0.88);
  line-height: 1.45;
}

/* Light mode overrides for Help & Support */
html[data-theme="light"] .hs-warn,
html.theme-light .hs-warn {
  border: 1px solid #FCD34D !important;
  background: linear-gradient(135deg, #FEFCE8 0%, #FEF3C7 100%) !important;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12) !important;
}

html[data-theme="light"] .hs-warn__en,
html.theme-light .hs-warn__en {
  color: #92400E !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .hs-warn__bn,
html.theme-light .hs-warn__bn {
  color: #B45309 !important;
  font-weight: 500 !important;
}

html[data-theme="light"] .hs-panel,
html.theme-light .hs-panel {
  background: #FFFFFF !important;
  border: 1px solid #DCE3EF !important;
  box-shadow: 0 24px 54px rgba(18, 22, 34, 0.18), 0 4px 16px rgba(18, 22, 34, 0.06) !important;
}

html[data-theme="light"] .hs-panel__title,
html.theme-light .hs-panel__title {
  color: #121620 !important;
}

html[data-theme="light"] .hs-panel__close,
html.theme-light .hs-panel__close {
  border-color: #DCE3EF !important;
  color: #64748B !important;
  background: #F8FAFC !important;
}

html[data-theme="light"] .hs-panel__close:hover,
html.theme-light .hs-panel__close:hover {
  background: #F1F5F9 !important;
  color: #0F172A !important;
  border-color: #CBD5E1 !important;
}

html[data-theme="light"] .hs-item__link,
html.theme-light .hs-item__link {
  background: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
  color: #1E293B !important;
  box-shadow: 0 2px 8px rgba(18, 22, 34, 0.04) !important;
}

html[data-theme="light"] .hs-item__link:hover,
html.theme-light .hs-item__link:hover {
  background: #FFFFFF !important;
  border-color: rgba(0, 158, 184, 0.55) !important;
  box-shadow: 0 6px 20px rgba(0, 158, 184, 0.14) !important;
}

html[data-theme="light"] .hs-item__icon,
html.theme-light .hs-item__icon {
  background: rgba(0, 158, 184, 0.12) !important;
  color: #009EB8 !important;
}

html[data-theme="light"] .hs-item__label,
html.theme-light .hs-item__label {
  color: #0F172A !important;
}

html[data-theme="light"] .hs-item__value,
html.theme-light .hs-item__value {
  color: #64748B !important;
}

html[data-theme="light"] .hs-fab,
html.theme-light .hs-fab {
  background: #FFFFFF !important;
  border: 1px solid rgba(0, 158, 184, 0.4) !important;
  color: #009EB8 !important;
  box-shadow: 0 4px 18px rgba(18, 22, 34, 0.1), 0 0 12px rgba(0, 158, 184, 0.16) !important;
}

html[data-theme="light"] .hs-fab:hover,
html.theme-light .hs-fab:hover {
  background: #009EB8 !important;
  color: #FFFFFF !important;
  box-shadow: 0 6px 24px rgba(0, 158, 184, 0.38) !important;
}

html[data-theme="light"] .wd-fab,
html.theme-light .wd-fab {
  background: #FFFFFF !important;
  border: 1px solid rgba(217, 119, 6, 0.4) !important;
  color: #D97706 !important;
  box-shadow: 0 4px 18px rgba(18, 22, 34, 0.1), 0 0 12px rgba(245, 158, 11, 0.16) !important;
}

html[data-theme="light"] .wd-fab:hover,
html.theme-light .wd-fab:hover {
  background: #D97706 !important;
  color: #FFFFFF !important;
  box-shadow: 0 6px 24px rgba(217, 119, 6, 0.38) !important;
}

html[data-theme="light"] .hs-overlay,
html.theme-light .hs-overlay {
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

.hs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hs-item__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hs-item__link:hover {
  border-color: rgba(63, 224, 208, 0.45);
  box-shadow: 0 0 12px rgba(63, 224, 208, 0.15);
}

.hs-item__icon {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(63, 224, 208, 0.1);
  color: var(--cyan, #3fe0d0);
}

.hs-item__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

.hs-item__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hs-item__label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
}

.hs-item__value {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hs-empty {
  margin: 8px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .hs-fab {
    right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hs-fab { transition: none; }
}

/* Desktop / wide — align with Withdraw at bottom: 24px */
@media (min-width: 900px) {
  .hs-fab {
    right: 22px;
    /* Withdraw bottom 24 + height 52 + gap 14 */
    bottom: calc(24px + 52px + 14px);
  }
}
