.wallet-modal-layer {
  z-index: 220;
}

.wallet-modal {
  width: min(100%, 470px);
  padding: 27px 28px 22px;
}

/* The production reader opens payment from the bottom edge on touch devices. */
@media (max-width: 600px) {
  .wallet-modal-layer {
    align-items: end;
    padding: 0;
  }

  .wallet-modal {
    width: min(100%, 750px);
    max-height: min(88dvh, 720px);
    overflow-y: auto;
    padding: 25px 20px max(20px, env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
    animation: wallet-sheet-in .22s ease-out;
  }

  .wallet-modal::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 4px;
    background: #e2e5e8;
    transform: translateX(-50%);
  }
}

@keyframes wallet-sheet-in {
  from { opacity: .35; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.wallet-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink-strong, #20231f);
}

.wallet-brand > span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.wallet-brand strong {
  font-size: 16px;
  line-height: 1.2;
}

.wallet-brand small {
  margin-top: 3px;
  color: var(--muted, #707873);
  font-size: 10px;
}

.wallet-brand em {
  margin-left: auto;
  padding: 5px 7px;
  border-radius: 999px;
  color: #087f4d;
  background: #e8f8ef;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.wallet-coin-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, #e7a941, #c87825);
  box-shadow: 0 7px 15px rgba(190, 117, 35, .24);
}

.wallet-coin-mark svg { width: 19px; height: 19px; }

.wallet-balance-panel {
  position: relative;
  margin: 22px 0 18px;
  padding: 14px 16px 13px;
  border: 1px solid #eadfca;
  border-radius: 11px;
  background: linear-gradient(110deg, #fffaf0, #fff 70%);
}

.wallet-balance-label {
  color: #9d8968;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .14em;
}

.wallet-balance-panel > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 4px;
}

.wallet-balance-panel strong {
  color: #5c3c18;
  font-size: 29px;
  line-height: 1;
}

.wallet-balance-panel > div > span {
  color: #9d8968;
  font-size: 12px;
  font-weight: 750;
}

.wallet-method-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 17px;
  padding: 10px 12px;
  border: 1px solid #e7ebe7;
  border-radius: 9px;
  background: #fbfcfb;
}

.wallet-method-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.wallet-method-brand > b {
  display: inline-grid;
  min-width: 53px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: #00a651;
  font-size: 11px;
  letter-spacing: -.02em;
}

.wallet-method-brand > span {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.wallet-method-brand strong {
  overflow: hidden;
  color: var(--ink, #20231f);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-method-brand small {
  margin-top: 3px;
  color: var(--muted-light, #9ca39f);
  font-size: 9px;
}

.wallet-currency {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  color: #087f4d;
  background: #e8f8ef;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .08em;
}

.wallet-history-toggle {
  position: absolute;
  right: 13px;
  bottom: 13px;
  padding: 5px 0;
  color: #9d7548;
  background: transparent;
  font-size: 10px;
  font-weight: 800;
}

.wallet-history-toggle:hover { color: #6b431c; }

.wallet-pending {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 18px;
  padding: 10px 11px;
  border: 1px solid #e4e0f8;
  border-radius: 9px;
  color: #5e5884;
  background: #f7f5ff;
}

.wallet-pending[hidden],
.wallet-history[hidden] {
  display: none !important;
}

.wallet-pending > span:first-child { flex: 0 0 auto; margin-top: 1px; color: #7b65d8; }
.wallet-pending > span:first-child svg { width: 15px; height: 15px; }
.wallet-pending strong, .wallet-pending small { display: block; }
.wallet-pending strong { font-size: 11px; line-height: 1.35; }
.wallet-pending small { margin-top: 3px; color: #797395; font-size: 10px; line-height: 1.4; }

.wallet-modal h2 { margin-top: 7px; font-size: 27px; }
.wallet-description { margin: 8px 0 17px; color: var(--muted, #707873); font-size: 11px; line-height: 1.5; }

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

.wallet-package {
  position: relative;
  min-width: 0;
  min-height: 126px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 13px 11px 11px;
  border: 1px solid #e3e7e2;
  border-radius: 10px;
  color: var(--ink, #20231f);
  background: #fbfcfa;
  text-align: left;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.wallet-package:hover { border-color: #c9bdf5; transform: translateY(-1px); }
.wallet-package.selected { border-color: #8066df; box-shadow: 0 0 0 2px rgba(128, 102, 223, .13); background: #faf9ff; }
.wallet-package.featured { border-color: #e2c999; }
.wallet-package-badge { position: absolute; top: -9px; right: 8px; padding: 3px 6px; border-radius: 999px; color: #7b551e; background: #f9e9c4; font-size: 8px; font-weight: 850; }
.wallet-package-name { color: var(--muted, #707873); font-size: 10px; font-weight: 750; }
.wallet-package > strong { margin-top: 8px; color: var(--ink-strong, #20231f); font-size: 19px; line-height: 1; }
.wallet-package-coins { margin-top: 9px; color: #805f2d; font-size: 11px; font-weight: 850; line-height: 1.25; }
.wallet-package-coins small { display: block; margin-top: 2px; color: #b47732; font-size: 9px; font-weight: 750; }
.wallet-package-note { margin-top: auto; padding-top: 9px; color: var(--muted-light, #9ca39f); font-size: 9px; }

.wallet-selected-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e8ebe7;
  color: var(--muted, #707873);
  font-size: 10px;
}

.wallet-selected-row strong { color: var(--ink, #20231f); font-size: 11px; white-space: nowrap; }
.wallet-status { min-height: 31px; margin: 10px 0 8px; color: var(--muted, #707873); font-size: 10px; line-height: 1.45; }
.wallet-status.error { color: #b24747; }

.wallet-recharge-button {
  width: 100%;
  min-height: 46px;
  border-radius: 9px;
  color: #fff;
  background: #00a651;
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 8px 16px rgba(0, 166, 81, .18);
}

.wallet-recharge-button:hover { background: #008d45; }
.wallet-recharge-button:disabled { cursor: wait; opacity: .62; }
.wallet-cancel { width: 100%; margin-top: 6px; padding: 8px; color: var(--muted, #707873); background: transparent; font-size: 11px; }
.wallet-cancel:hover { color: var(--ink, #20231f); }
.wallet-note { display: block; margin-top: 10px; color: #a0aaa3; font-size: 9px; line-height: 1.45; text-align: center; }

.wallet-history { margin-top: 18px; padding-top: 15px; border-top: 1px solid #e8ebe7; }
.wallet-history-heading { display: flex; justify-content: space-between; color: var(--muted, #707873); font-size: 9px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.wallet-history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f1ef; }
.wallet-history-row span { min-width: 0; display: flex; flex-direction: column; }
.wallet-history-row strong { overflow: hidden; color: var(--ink, #20231f); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.wallet-history-row small { margin-top: 3px; color: var(--muted-light, #9ca39f); font-size: 9px; }
.wallet-history-row b { flex: 0 0 auto; font-size: 11px; }
.wallet-history-row b.positive { color: #168257; }
.wallet-history-row b.negative { color: #a66b4f; }
.wallet-history-empty { margin: 13px 0 2px; color: var(--muted-light, #9ca39f); font-size: 10px; text-align: center; }

[data-wallet-open] { position: relative; }
.wallet-trigger { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; border: 1px solid #eadfca; border-radius: 999px; color: #805f2d; background: #fffaf0; font-size: 10px; font-weight: 850; white-space: nowrap; }
.wallet-trigger svg { width: 15px; height: 15px; color: #c7862e; }
.wallet-trigger:hover { border-color: #d8c194; background: #fff5df; }
.wallet-trigger strong { font-size: 10px; }
.chapter-lock.coin-lock { color: #087f4d; background: #e8f8ef; }
.coin-rate-note { margin: 11px 0 0; color: #8a938d; font-size: 10px; line-height: 1.4; }

.home-wallet-trigger {
  flex: 0 0 auto;
  min-height: 39px;
  padding-inline: 9px;
  border-color: rgba(255, 255, 255, .28);
  color: #fff;
  background: rgba(255, 255, 255, .16);
}

.home-wallet-trigger svg { color: #fff; }
.home-header.scrolled .home-wallet-trigger { border-color: #eadfca; color: #805f2d; background: #fffaf0; }
.home-header.scrolled .home-wallet-trigger svg { color: #c7862e; }

.detail-wallet-trigger {
  position: absolute;
  top: 11px;
  right: 17px;
  z-index: 2;
}

.mobile-wallet-trigger {
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 42px;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 3px 7px;
  border: 0;
  border-radius: 7px;
  color: #805f2d;
  background: #fffaf0;
  font-size: 8px;
  line-height: 1.1;
}

.mobile-wallet-trigger svg { width: 17px; height: 17px; }
.mobile-wallet-trigger strong { font-size: 10px; }

@media (max-width: 760px) {
  .wallet-modal { width: 100%; max-height: calc(100dvh - 15px); padding: 23px 17px 18px; border-radius: 16px 16px 0 0; }
  .wallet-modal h2 { font-size: 24px; }
  .wallet-package { min-height: 119px; padding: 11px 9px 10px; }
  .wallet-package > strong { font-size: 17px; }
  .wallet-package-coins { font-size: 10px; }
  .wallet-brand em { font-size: 8px; }
  .detail-wallet-trigger { top: 9px; right: 15px; min-height: 31px; padding-inline: 8px; }
  .detail-wallet-trigger svg { width: 14px; height: 14px; }
  .detail-wallet-trigger span { display: none; }
  .home-wallet-trigger { min-height: 39px; padding-inline: 7px; }
  .home-wallet-trigger span { display: none; }
}

@media (max-width: 360px) {
  .wallet-package-grid { gap: 5px; }
  .wallet-package { padding-inline: 7px; }
  .wallet-package-name { font-size: 9px; }
}
