:root {
  --pp-night: #111014;
  --pp-panel: #1a171c;
  --pp-panel-2: #211d23;
  --pp-paper: #fffdf8;
  --pp-muted: rgba(255, 253, 248, 0.52);
  --pp-line: rgba(255, 255, 255, 0.12);
  --pp-red: #d93f44;
  --pp-gold: #efc56f;
  --pp-green: #7ee39a;
}

.pp-page {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  color: var(--pp-paper);
  background: var(--pp-night);
  font-family: "DM Sans", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  overflow: hidden;
}

.pp-page button,
.pp-page input {
  font: inherit;
}

.pp-page button {
  color: inherit;
}

.pp-shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: max(18px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 13% 14%, rgba(217, 63, 68, 0.16), transparent 26%),
    radial-gradient(circle at 88% 82%, rgba(239, 197, 111, 0.08), transparent 28%),
    linear-gradient(145deg, #0d0c10, #171419 58%, #0f0e12);
}

.pp-shell::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: linear-gradient(135deg, #000, transparent 78%);
}

.pp-header,
.pp-footer {
  position: relative;
  z-index: 3;
  width: min(100%, 1180px);
  margin-inline: auto;
}

.pp-header {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.pp-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.pp-brand .brand-mark {
  width: 36px;
  height: 36px;
}

.pp-brand > span:last-child {
  display: grid;
  line-height: 1.05;
}

.pp-brand strong {
  font-family: "Manrope", "Leelawadee UI", sans-serif;
  font-size: 0.92rem;
}

.pp-brand small {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.pp-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pp-icon-button,
.pp-version-button,
.pp-close-button {
  border: 1px solid var(--pp-line);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.pp-icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.pp-icon-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.pp-version-button {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.pp-icon-button:hover,
.pp-icon-button:focus-visible,
.pp-version-button:hover,
.pp-version-button:focus-visible {
  border-color: rgba(217, 63, 68, 0.72);
  color: #fff;
}

.pp-main,
.pp-view {
  min-height: 0;
}

.pp-main {
  display: grid;
  place-items: center;
}

.pp-view {
  width: min(100%, 480px);
  max-height: 100%;
}

.pp-view[hidden] {
  display: none;
}

.pp-panel {
  max-height: 100%;
  padding: clamp(18px, 3vh, 28px) clamp(20px, 3vw, 30px);
  border: 1px solid var(--pp-line);
  border-radius: 28px;
  background: rgba(26, 23, 28, 0.88);
  box-shadow: 0 28px 85px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(18px);
}

.pp-step {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.34);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.pp-step span {
  color: var(--pp-red);
}

.pp-step i {
  height: 1px;
  background: var(--pp-line);
}

.pp-step em {
  font-style: normal;
}

.pp-copy {
  margin-top: clamp(14px, 2.2vh, 22px);
}

.pp-copy-centered {
  text-align: center;
}

.pp-kicker {
  margin: 0 0 7px;
  color: var(--pp-red);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pp-copy h1,
.pp-qr-heading h1 {
  margin: 0;
  font-family: "Manrope", "Leelawadee UI", sans-serif;
  font-size: clamp(2rem, 4.5vh, 2.85rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.pp-copy h1 span {
  color: var(--pp-gold);
}

.pp-copy > p:last-child {
  margin: 10px auto 0;
  color: var(--pp-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.pp-type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: clamp(14px, 2vh, 20px);
  padding: 4px;
  border: 1px solid var(--pp-line);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.14);
}

.pp-type-switch button {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  color: var(--pp-muted);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.pp-type-switch button.is-active {
  color: #fff;
  background: #343039;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.2);
}

.pp-display-field {
  display: grid;
  margin-top: 12px;
}

.pp-display-field > span {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pp-display-field input {
  width: 100%;
  height: 48px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  outline: 0;
  color: #fff;
  background: transparent;
  font-family: "Manrope", monospace;
  font-size: clamp(1.35rem, 3.2vh, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.035em;
  caret-color: transparent;
}

.pp-display-field input:focus {
  border-color: var(--pp-red);
}

.pp-display-field input::placeholder {
  color: rgba(255, 255, 255, 0.18);
}

.pp-field-hint,
.pp-error {
  min-height: 15px;
  margin: 5px 0 0;
  font-size: 0.59rem;
}

.pp-field-hint {
  color: rgba(255, 255, 255, 0.32);
}

.pp-error {
  color: #ff868a;
}

.pp-error:empty {
  display: none;
}

.pp-error-centered {
  text-align: center;
}

.pp-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: clamp(10px, 1.8vh, 16px);
}

.pp-numpad button {
  min-height: clamp(42px, 6.2vh, 54px);
  border: 1px solid var(--pp-line);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.035);
  font-family: "Manrope", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 100ms ease, transform 100ms ease;
}

.pp-numpad button:hover,
.pp-numpad button:focus-visible {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.09);
}

.pp-numpad button:active {
  transform: scale(0.96);
}

.pp-numpad .pp-key-muted {
  color: var(--pp-gold);
  font-size: 0.82rem;
}

.pp-primary,
.pp-secondary {
  min-height: 47px;
  border: 0;
  border-radius: 13px;
  font-weight: 800;
  cursor: pointer;
}

.pp-primary {
  color: #fff;
  background: var(--pp-red);
}

.pp-primary:hover,
.pp-primary:focus-visible {
  background: #ea4b50;
}

.pp-secondary {
  color: rgba(255, 255, 255, 0.68);
  background: #302c34;
}

#save-recipient {
  width: 100%;
  margin-top: 10px;
}

.pp-amount-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 9px;
  margin: clamp(17px, 3vh, 26px) auto 0;
}

.pp-amount-display > span {
  color: var(--pp-gold);
  font-family: "Manrope", sans-serif;
  font-size: 1.3rem;
}

.pp-amount-display input {
  width: min(78%, 300px);
  padding: 0;
  border: 0;
  outline: 0;
  color: #fff;
  background: transparent;
  font-family: "Manrope", sans-serif;
  font-size: clamp(2.7rem, 7vh, 4.3rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.06em;
  text-align: center;
  caret-color: transparent;
}

.pp-amount-actions,
.pp-qr-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.pp-amount-actions {
  grid-template-columns: 1fr;
}

.pp-qr-actions {
  grid-template-columns: 1fr 1fr;
}

.pp-qr-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-top: clamp(15px, 2vh, 22px);
}

.pp-qr-amount {
  color: var(--pp-gold);
  font-family: "Manrope", sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  text-align: right;
}

.pp-qr-amount small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.34);
  font-family: inherit;
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pp-qr-card {
  width: min(100%, 340px);
  margin: clamp(14px, 2.3vh, 22px) auto 0;
  padding: clamp(12px, 2vh, 17px);
  border-radius: 22px;
  color: #171419;
  background: #fff;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

.pp-qr-code {
  width: min(100%, 270px);
  aspect-ratio: 1;
  margin-inline: auto;
}

.pp-qr-code svg {
  width: 100%;
  height: 100%;
  display: block;
}

.pp-qr-meta {
  display: grid;
  gap: 1px;
  padding: 8px 4px 0;
  border-top: 1px solid rgba(21, 19, 24, 0.12);
  text-align: center;
}

.pp-qr-meta span {
  color: rgba(21, 19, 24, 0.48);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pp-qr-meta strong {
  font-family: "Manrope", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.pp-qr-note {
  margin: 11px 0 0;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.61rem;
  text-align: center;
}

.pp-qr-note i {
  width: 5px;
  height: 5px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--pp-green);
  box-shadow: 0 0 0 3px rgba(126, 227, 154, 0.11);
}

.pp-footer {
  min-height: 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 14px;
  padding: 0;
  border: 0;
  color: rgba(255, 255, 255, 0.27);
  background: transparent;
  font-size: 0.49rem;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.pp-footer span:first-child {
  color: var(--pp-green);
}

.pp-footer span:nth-child(2) {
  justify-self: center;
  letter-spacing: 0;
}

.pp-modal {
  width: min(calc(100% - 32px), 540px);
  max-height: min(80vh, 650px);
  padding: 0;
  border: 1px solid var(--pp-line);
  border-radius: 24px;
  color: var(--pp-paper);
  background: #1a171c;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.56);
}

.pp-modal::backdrop {
  background: rgba(7, 6, 9, 0.74);
  backdrop-filter: blur(6px);
}

.pp-modal[open] {
  animation: pp-modal-in 180ms ease both;
}

.pp-modal-head {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--pp-line);
  background: #1a171c;
}

.pp-modal h2 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 1.75rem;
}

.pp-close-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.45rem;
  line-height: 1;
}

.pp-release {
  margin: 0 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--pp-line);
}

.pp-release > div {
  display: flex;
  justify-content: space-between;
  color: var(--pp-red);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
}

.pp-release time {
  color: rgba(255, 255, 255, 0.34);
}

.pp-release h3 {
  margin: 10px 0 14px;
  font-family: "Manrope", sans-serif;
}

.pp-release ul {
  margin: 0;
  padding-left: 20px;
  color: var(--pp-muted);
  font-size: 0.82rem;
}

.pp-release li + li {
  margin-top: 7px;
}

.pp-license-note {
  margin: 0;
  padding: 18px 24px 24px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.64rem;
  line-height: 1.55;
}

@keyframes pp-modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
}

@media (max-height: 760px) {
  .pp-shell {
    padding-block: 12px 9px;
  }

  .pp-panel {
    padding-block: 16px;
  }

  .pp-copy {
    margin-top: 10px;
  }

  .pp-copy h1,
  .pp-qr-heading h1 {
    font-size: 1.9rem;
  }

  .pp-copy > p:last-child {
    margin-top: 6px;
  }

  .pp-type-switch {
    margin-top: 10px;
  }

  .pp-numpad {
    margin-top: 8px;
  }

  .pp-numpad button {
    min-height: 39px;
  }

  .pp-amount-display {
    margin-top: 12px;
  }

  .pp-qr-card {
    width: min(100%, 295px);
    margin-top: 10px;
    padding: 10px;
  }

  .pp-qr-code {
    width: min(100%, 225px);
  }
}

@media (max-width: 520px) {
  .pp-shell {
    padding-inline: 14px;
  }

  .pp-view {
    width: 100%;
  }

  .pp-panel {
    border-radius: 22px;
  }

  .pp-footer span:nth-child(2) {
    display: none;
  }

  .pp-footer {
    grid-template-columns: 1fr auto;
  }
}

@media (max-width: 380px), (max-height: 670px) {
  .pp-header {
    min-height: 38px;
  }

  .pp-brand .brand-mark {
    width: 30px;
    height: 30px;
  }

  .pp-brand strong {
    font-size: 0.8rem;
  }

  .pp-copy > p:last-child,
  .pp-field-hint {
    display: none;
  }

  .pp-display-field {
    margin-top: 8px;
  }

  .pp-display-field input {
    height: 40px;
  }

  .pp-numpad button {
    min-height: 35px;
  }

  .pp-primary,
  .pp-secondary {
    min-height: 41px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pp-modal[open] {
    animation: none;
  }
}
