:root {
  --vlw-accent: #d7263d;
  --vlw-accent-dark: #af172c;
  --vlw-bg: #ffffff;
  --vlw-text: #171923;
  --vlw-muted: #71717a;
  --vlw-border: #e8e8ee;
  --vlw-soft: #f7f7fa;
  --vlw-motion-duration: 460ms;
  --vlw-motion-fast: 320ms;
  --vlw-motion-ease: cubic-bezier(.16, 1, .3, 1);
}

.vlw-is-open { overflow: hidden; }

.vlw-account-pill,
.vlw-open-button,
.vlw-submit,
.vlw-close,
.vlw-number-control button,
.vlw-code-row button {
  font: inherit;
}

.vlw-account-pill {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--vlw-border);
  background: linear-gradient(135deg, #fff 0%, #fff5f6 100%);
  color: var(--vlw-text);
  border-radius: 16px;
  padding: 12px 14px;
  margin: 0 0 16px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(30, 30, 45, .06);
}
.vlw-account-pill__star { color: #f6b800; font-size: 20px; }
.vlw-account-pill b {
  margin-inline-start: auto;
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--vlw-accent);
  color: #fff;
}

.vlw-dashboard-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 18px;
  margin: 0 0 24px;
  border: 1px solid var(--vlw-border);
  border-radius: 20px;
  background: linear-gradient(135deg, #fff 0%, #fff4f6 100%);
  box-shadow: 0 12px 36px rgba(20, 20, 35, .07);
}
.vlw-dashboard-card__icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #fff0c7;
  color: #e7a900;
  font-size: 24px;
}
.vlw-dashboard-card__content { display: flex; flex-direction: column; gap: 3px; }
.vlw-dashboard-card__content span { color: var(--vlw-muted); font-size: 14px; }

.vlw-open-button,
.vlw-submit {
  border: 0;
  border-radius: 13px;
  padding: 11px 16px;
  background: var(--vlw-accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  transition: transform var(--vlw-motion-fast) var(--vlw-motion-ease), background var(--vlw-motion-fast) ease, box-shadow var(--vlw-motion-fast) var(--vlw-motion-ease);
}
.vlw-open-button:hover,
.vlw-submit:hover { background: var(--vlw-accent-dark); transform: translateY(-1px); box-shadow: 0 9px 22px rgba(215, 38, 61, .22); }

.vlw-overlay {
  position: fixed;
  inset: 0;
  z-index: 999998;
  background: rgba(12, 14, 20, .58);
  opacity: 0;
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  will-change: opacity, backdrop-filter;
  transition:
    opacity 380ms ease,
    -webkit-backdrop-filter var(--vlw-motion-duration) var(--vlw-motion-ease),
    backdrop-filter var(--vlw-motion-duration) var(--vlw-motion-ease);
}
.vlw-overlay.is-open {
  opacity: 1;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.vlw-sheet {
  position: fixed;
  z-index: 999999;
  inset-inline: 0;
  bottom: 0;
  width: min(100%, 620px);
  max-height: min(88vh, 760px);
  overflow: auto;
  margin-inline: auto;
  padding: 12px 22px 24px;
  border-radius: 28px 28px 0 0;
  background: var(--vlw-bg);
  color: var(--vlw-text);
  box-shadow: 0 -18px 55px rgba(0, 0, 0, .14);
  opacity: .96;
  transform: translate3d(0, calc(100% + 24px), 0) scale(.985);
  transform-origin: center bottom;
  will-change: transform, opacity, box-shadow;
  transition:
    transform var(--vlw-motion-duration) var(--vlw-motion-ease),
    opacity 340ms ease,
    box-shadow var(--vlw-motion-duration) var(--vlw-motion-ease);
  direction: rtl;
}
.vlw-sheet.is-open {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  box-shadow: 0 -28px 80px rgba(0, 0, 0, .24);
}
.vlw-sheet__handle { width: 48px; height: 5px; border-radius: 999px; background: #d7d7dd; margin: 0 auto 14px; }
.vlw-sheet__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.vlw-sheet__header h2 { margin: 3px 0 0; font-size: clamp(20px, 4vw, 27px); }
.vlw-kicker { color: var(--vlw-accent); font-size: 13px; font-weight: 800; }
.vlw-close { width: 42px; height: 42px; border: 1px solid var(--vlw-border); border-radius: 13px; background: #fff; color: var(--vlw-text); cursor: pointer; font-size: 28px; line-height: 1; transition: transform var(--vlw-motion-fast) var(--vlw-motion-ease), background var(--vlw-motion-fast) ease, border-color var(--vlw-motion-fast) ease; }
.vlw-close:hover { transform: rotate(4deg) scale(1.04); background: var(--vlw-soft); border-color: #dcdce4; }
.vlw-close:active { transform: scale(.94); }

.vlw-balance-box {
  display: grid;
  place-items: center;
  gap: 4px;
  margin: 22px 0;
  padding: 20px;
  border: 1px solid #ffe0e4;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff7f8, #fff);
}
.vlw-balance-box span { color: var(--vlw-muted); }
.vlw-balance-box strong { color: var(--vlw-accent); font-size: 42px; line-height: 1.2; }
.vlw-balance-box small { color: var(--vlw-muted); }

.vlw-redeem-form { display: grid; gap: 13px; }
.vlw-redeem-form > label { font-weight: 750; }
.vlw-number-control { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; }
.vlw-number-control input,
.vlw-number-control button {
  height: 52px;
  border: 1px solid var(--vlw-border);
  border-radius: 14px;
  background: var(--vlw-soft);
  text-align: center;
  color: var(--vlw-text);
}
.vlw-number-control input { font-size: 19px; font-weight: 800; -moz-appearance: textfield; }
.vlw-number-control input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.vlw-number-control button { cursor: pointer; font-size: 24px; }
.vlw-conversion-preview { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 13px; background: var(--vlw-soft); color: var(--vlw-muted); }
.vlw-conversion-preview b { color: var(--vlw-text); }
.vlw-submit { width: 100%; min-height: 52px; }
.vlw-submit:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.vlw-submit.is-loading { position: relative; color: transparent; }
.vlw-submit.is-loading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 19px; height: 19px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: vlw-spin .7s linear infinite; }
@keyframes vlw-spin { to { transform: rotate(360deg); } }

.vlw-result { margin-top: 17px; padding: 16px; border: 1px solid #ccebd7; border-radius: 17px; background: #f2fff6; }
.vlw-result > span { display: block; margin-bottom: 10px; font-weight: 800; }
.vlw-code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.vlw-code-row code { display: flex; align-items: center; direction: ltr; border: 1px dashed #84c99d; border-radius: 12px; padding: 10px 13px; background: #fff; color: #126b32; font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.vlw-code-row button { border: 0; border-radius: 12px; padding: 0 15px; background: #17813e; color: #fff; cursor: pointer; }
.vlw-result small { display: block; margin-top: 9px; color: #447251; }
.vlw-message { margin-top: 12px; padding: 11px 13px; border-radius: 12px; }
.vlw-message.is-error { background: #fff0f1; color: #a91c2e; }
.vlw-message.is-success { background: #effcf3; color: #16713a; }
.vlw-security-note, .vlw-empty { margin: 14px 0 0; color: var(--vlw-muted); font-size: 13px; line-height: 1.8; }


.vlw-guest-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 26px 20px 20px;
  border: 1px solid #ffe0e4;
  border-radius: 22px;
  background: linear-gradient(145deg, #fff7f8, #fff);
  text-align: center;
}
.vlw-guest-state__icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: #fff0f2;
  font-size: 29px;
  box-shadow: inset 0 0 0 1px rgba(215, 38, 61, .08);
}
.vlw-guest-state h3 { margin: 3px 0 0; font-size: 20px; }
.vlw-guest-state p { max-width: 430px; margin: 0; color: var(--vlw-muted); line-height: 1.9; }
.vlw-login-button {
  width: min(100%, 330px);
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  border-radius: 14px;
  background: var(--vlw-accent);
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 800;
  transition: transform var(--vlw-motion-fast) var(--vlw-motion-ease), background var(--vlw-motion-fast) ease, box-shadow var(--vlw-motion-fast) var(--vlw-motion-ease);
}
.vlw-login-button:hover {
  background: var(--vlw-accent-dark);
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 9px 22px rgba(215, 38, 61, .22);
}

.vlw-endpoint > h2 { margin-bottom: 8px; }
.vlw-history { margin-top: 28px; }
.vlw-history h3 { margin-bottom: 12px; }
.vlw-history__list { display: grid; gap: 9px; }
.vlw-history__item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 15px; border: 1px solid var(--vlw-border); border-radius: 14px; background: #fff; }
.vlw-history__item > div { display: grid; gap: 3px; }
.vlw-history__item small { color: var(--vlw-muted); }
.vlw-history__item .is-plus { color: #168340; }
.vlw-history__item .is-minus { color: #bb2438; }

@media (max-width: 650px) {
  .vlw-dashboard-card { grid-template-columns: auto 1fr; }
  .vlw-dashboard-card .vlw-open-button { grid-column: 1 / -1; width: 100%; }
  .vlw-sheet { padding-inline: 16px; max-height: 92vh; }
  .vlw-history__item { align-items: flex-start; flex-direction: column; }
}

@media (min-width: 900px) {
  .vlw-sheet { bottom: 18px; border-radius: 28px; }
}

.vlw-sticky-button {
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 999990;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, .26);
  border-radius: 999px;
  padding: 7px 8px 7px 14px;
  background: linear-gradient(135deg, var(--vlw-accent), var(--vlw-accent-dark));
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 38px rgba(25, 25, 35, .24), 0 6px 18px rgba(215, 38, 61, .25);
  transition: transform 360ms var(--vlw-motion-ease), box-shadow 360ms var(--vlw-motion-ease), filter 360ms ease;
  direction: rtl;
}
.vlw-sticky-button.is-left { left: 22px; }
.vlw-sticky-button.is-right { right: 22px; }
.vlw-sticky-button:hover { transform: translateY(-3px) scale(1.015); box-shadow: 0 18px 44px rgba(25, 25, 35, .28), 0 8px 22px rgba(215, 38, 61, .3); }
.vlw-sticky-button:active { transform: translateY(0) scale(.96); }
.vlw-sticky-button:focus-visible { outline: 3px solid rgba(215, 38, 61, .28); outline-offset: 3px; }
.vlw-sticky-button__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  color: #ffd76a;
  font-size: 21px;
  line-height: 1;
}
.vlw-sticky-button b {
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  padding-inline: 7px;
  background: #fff;
  color: var(--vlw-accent-dark);
  font-size: 13px;
}

@media (max-width: 650px) {
  .vlw-sticky-button {
    /* پایین‌تر از لایه منوی موبایل، اما بالاتر از محتوای عادی صفحه */
    z-index: 20;
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    gap: 0;
    justify-content: center;
    border-radius: 14px;
    box-shadow: 0 9px 22px rgba(25, 25, 35, .20), 0 4px 12px rgba(215, 38, 61, .22);
  }
  .vlw-sticky-button.is-left { left: 12px; }
  .vlw-sticky-button.is-right { right: 12px; }
  .vlw-sticky-button__icon {
    width: 100%;
    height: 100%;
    background: transparent;
    font-size: 18px;
  }
  .vlw-sticky-button__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .vlw-sticky-button b {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 21px;
    height: 21px;
    padding-inline: 4px;
    border: 2px solid #fff;
    font-size: 9px;
    line-height: 1;
    box-shadow: 0 4px 9px rgba(0, 0, 0, .15);
  }
}

@media (max-width: 380px) {
  .vlw-sticky-button {
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
  }
}

.vlw-sheet__header,
.vlw-balance-box,
.vlw-redeem-form,
.vlw-guest-state,
.vlw-result,
.vlw-security-note {
  transition: transform 420ms var(--vlw-motion-ease), opacity 320ms ease;
}
.vlw-sheet:not(.is-open) .vlw-sheet__header,
.vlw-sheet:not(.is-open) .vlw-balance-box,
.vlw-sheet:not(.is-open) .vlw-redeem-form,
.vlw-sheet:not(.is-open) .vlw-guest-state,
.vlw-sheet:not(.is-open) .vlw-result,
.vlw-sheet:not(.is-open) .vlw-security-note {
  opacity: .72;
  transform: translateY(8px);
}
.vlw-sheet.is-open .vlw-sheet__header { transition-delay: 40ms; }
.vlw-sheet.is-open .vlw-balance-box,
.vlw-sheet.is-open .vlw-guest-state { transition-delay: 70ms; }
.vlw-sheet.is-open .vlw-redeem-form { transition-delay: 100ms; }

@media (prefers-reduced-motion: reduce) {
  .vlw-overlay,
  .vlw-sheet,
  .vlw-sheet__header,
  .vlw-balance-box,
  .vlw-redeem-form,
  .vlw-guest-state,
  .vlw-result,
  .vlw-security-note,
  .vlw-sticky-button,
  .vlw-login-button,
  .vlw-open-button,
  .vlw-submit,
  .vlw-close {
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
