:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Helvetica, Arial, sans-serif;
  font-synthesis: none;
  --black: #202020;
  --muted: #777b82;
  --line: #d8dadd;
  --soft: #f4f5f6;
  --disabled: #a7a7a7;
  --green: #2fa44f;
  --green-deep: #258e42;
  background: #eef0f2;
  color: var(--black);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: #eef0f2;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: #eef0f2;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button,
.logo-dropzone {
  touch-action: manipulation;
}

.app-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 42px rgb(15 23 42 / 10%);
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  background: #fff;
}

.screen.is-active {
  animation: screen-in 240ms ease-out both;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.screen__content {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(42px + env(safe-area-inset-top)) 28px calc(24px + env(safe-area-inset-bottom));
}

.overline {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.config-content {
  display: flex;
  flex-direction: column;
}

.config-header h1 {
  max-width: 360px;
  margin: 0;
  font-size: clamp(31px, 8vw, 42px);
  font-weight: 660;
  letter-spacing: -0.035em;
  line-height: 1.06;
}

.config-header > p:last-child {
  max-width: 350px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.config-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 28px;
  margin-top: 42px;
}

.field {
  display: grid;
  gap: 10px;
}

.field > label,
.field-label-row label {
  font-size: 15px;
  font-weight: 650;
}

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.field-label-row span {
  color: var(--muted);
  font-size: 13px;
}

.field input[type="text"] {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--black);
  font-size: 17px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input[type="text"]:focus {
  border-color: #252525;
  box-shadow: 0 0 0 3px rgb(32 32 32 / 8%);
}

.field input[type="text"]::placeholder {
  color: #aaaeb4;
}

.logo-dropzone {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  align-items: center;
  min-height: 120px;
  padding: 15px;
  border: 1px dashed #b9bcc1;
  border-radius: 12px;
  outline: none;
  background: #fafafa;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.logo-dropzone:hover,
.logo-dropzone:focus-visible,
.logo-dropzone.is-dragging {
  border-color: #252525;
  background: #f4f4f4;
}

.logo-dropzone.is-dragging {
  transform: scale(0.99);
}

.upload-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.upload-copy strong {
  font-size: 15px;
}

.upload-copy span,
.upload-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.upload-copy small {
  color: #a0a3a8;
}

.remove-logo {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: #a52222;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.field-error {
  min-height: 17px;
  margin: -2px 0 0;
  color: #b3261e;
  font-size: 12px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.merchant-brand {
  display: grid;
  place-items: center;
}

.merchant-brand img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-fallback {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
}

.brand-symbol {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 4px;
  background: #e3262e;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-fallback strong {
  overflow: hidden;
  color: #121212;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-overflow: ellipsis;
}

.merchant-brand--upload {
  width: 88px;
  height: 88px;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
}

.merchant-brand--upload .brand-fallback {
  display: grid;
  gap: 5px;
  justify-items: center;
}

.merchant-brand--upload .brand-symbol {
  width: 45px;
  height: 45px;
  font-size: 15px;
}

.merchant-brand--upload .brand-fallback strong {
  width: 76px;
  font-size: 9px;
  text-align: center;
  white-space: nowrap;
}

.bottom-action {
  margin-top: auto;
  padding: 20px 4px calc(22px + env(safe-area-inset-bottom));
}

.bottom-action--config {
  padding-right: 0;
  padding-bottom: 0;
  padding-left: 0;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-size: 20px;
  font-weight: 500;
  transition: transform 100ms ease, background 160ms ease, opacity 160ms ease;
}

.primary-button {
  background: var(--black);
  color: #fff;
}

.primary-button:disabled {
  background: var(--disabled);
  cursor: default;
}

.primary-button:not(:disabled):active,
.secondary-button:active {
  transform: scale(0.985);
}

.amount-layout,
.confirmation-layout,
.success-layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
}

.merchant-brand--hero {
  width: min(68%, 265px);
  height: 190px;
  margin: calc(34px + env(safe-area-inset-top)) auto 0;
}

.merchant-brand--hero .brand-fallback {
  flex-direction: column;
  gap: 14px;
  text-align: center;
}

.merchant-brand--hero .brand-symbol {
  width: 82px;
  height: 82px;
  border-radius: 7px;
  font-size: 27px;
}

.merchant-brand--hero .brand-fallback strong {
  max-width: 245px;
  font-size: clamp(24px, 7vw, 34px);
  line-height: 0.98;
  overflow-wrap: anywhere;
}

.amount-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 26px 28px 0;
}

.amount-form > label {
  font-size: 19px;
  font-weight: 450;
}

.amount-control {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  height: 88px;
  margin-top: 4px;
  border-bottom: 1px solid #c9cbd0;
  color: #aaacae;
  transition: color 160ms ease, border-color 160ms ease;
}

.amount-control:focus-within,
.amount-control.has-value {
  border-color: #aaa;
  color: var(--black);
}

.amount-control > span,
.amount-control input {
  font-size: clamp(43px, 13vw, 58px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.amount-control > span {
  white-space: nowrap;
}

.amount-control input {
  width: min(210px, 52vw);
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--black);
}

.amount-control input::placeholder {
  color: #aaacae;
  opacity: 1;
}

.amount-error {
  margin-top: 9px;
  text-align: center;
}

.amount-form .bottom-action {
  width: calc(100% + 8px);
  margin-left: -4px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  min-height: calc(58px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 20px 13px;
  border-bottom: 1px solid #e7e7e7;
  background: rgb(255 255 255 / 96%);
}

.topbar strong {
  font-size: 16px;
}

.topbar button {
  justify-self: end;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: #267cc4;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
}

.confirmation-layout {
  min-height: calc(100vh - 58px - env(safe-area-inset-top));
  min-height: calc(100dvh - 58px - env(safe-area-inset-top));
  padding: 0 24px;
}

.confirmation-message {
  display: grid;
  justify-items: center;
  padding: 74px 18px 40px;
  text-align: center;
}

.confirmation-message h1 {
  margin: 42px 0 0;
  font-size: clamp(21px, 6vw, 27px);
  font-weight: 520;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.hexagon {
  position: relative;
  display: grid;
  width: 76px;
  height: 86px;
  place-items: center;
  clip-path: polygon(25% 6.7%, 75% 6.7%, 100% 50%, 75% 93.3%, 25% 93.3%, 0 50%);
}

.hexagon::before {
  position: absolute;
  z-index: 0;
  content: "";
  inset: 3px;
  clip-path: inherit;
}

.hexagon--outline {
  background: #c8c8c8;
}

.hexagon--outline::before {
  background: #fff;
}

.payment-summary {
  width: 100%;
  margin-top: auto;
  padding: 18px 18px 20px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 3px 24px rgb(0 0 0 / 8%);
}

.summary-row {
  display: grid;
}

.summary-row > span {
  color: #5f6368;
  font-size: 12px;
  font-weight: 500;
}

.summary-row--amount strong {
  margin-top: 11px;
  color: #202020;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.025em;
  text-align: center;
}

.summary-divider {
  position: relative;
  height: 1px;
  margin: 20px 0 13px;
  background: #dedede;
}

.summary-divider::after {
  position: absolute;
  top: -1px;
  left: 50%;
  width: 13px;
  height: 13px;
  border-right: 1px solid #dedede;
  border-bottom: 1px solid #dedede;
  background: #fff;
  content: "";
  transform: translate(-50%, -50%) rotate(45deg);
}

.summary-row--recipient {
  gap: 12px;
}

.merchant-brand--summary {
  min-height: 78px;
  padding: 4px 8px 0;
}

.merchant-brand--summary img {
  max-width: 190px;
  max-height: 72px;
}

.merchant-brand--summary .brand-symbol {
  width: 58px;
  height: 58px;
  font-size: 18px;
}

.merchant-brand--summary .brand-fallback strong {
  max-width: 210px;
  font-size: 20px;
}

.bottom-action--confirmation {
  padding-right: 0;
  padding-left: 0;
}

.screen--success {
  background: var(--green);
  color: #fff;
}

.success-layout {
  padding: 0 24px;
  background: linear-gradient(145deg, #3db65b 0%, var(--green) 52%, var(--green-deep) 100%);
}

.success-message {
  display: grid;
  justify-items: center;
  padding: calc(74px + env(safe-area-inset-top)) 20px 44px;
  text-align: center;
}

.hexagon--success {
  width: 102px;
  height: 114px;
  background: rgb(255 255 255 / 92%);
  animation: success-pop 520ms cubic-bezier(0.2, 0.9, 0.28, 1.25) both;
}

.hexagon--success::before {
  inset: 3px;
  background: var(--green);
}

.hexagon--success span {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 48px;
  margin-top: -9px;
  border-right: 6px solid #fff;
  border-bottom: 6px solid #fff;
  transform: rotate(43deg);
  animation: check-in 360ms 300ms ease-out both;
}

@keyframes success-pop {
  from {
    opacity: 0;
    transform: scale(0.55);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes check-in {
  from {
    opacity: 0;
    transform: rotate(43deg) scale(0.45);
  }
  to {
    opacity: 1;
    transform: rotate(43deg) scale(1);
  }
}

.success-message h1 {
  margin: 25px 0 6px;
  font-size: 27px;
  font-weight: 550;
  letter-spacing: -0.025em;
}

.success-message time {
  font-size: 17px;
  font-weight: 450;
  opacity: 0.95;
}

.payment-summary--success {
  margin-top: auto;
  color: var(--black);
  box-shadow: 0 5px 30px rgb(8 73 29 / 22%);
}

.bottom-action--success {
  padding-right: 0;
  padding-left: 0;
}

.secondary-button {
  background: #fff;
  color: var(--black);
  box-shadow: 0 4px 20px rgb(8 73 29 / 14%);
}

@media (max-height: 720px) {
  .screen__content {
    padding-top: calc(26px + env(safe-area-inset-top));
  }

  .config-form {
    gap: 18px;
    margin-top: 28px;
  }

  .logo-dropzone {
    min-height: 100px;
  }

  .merchant-brand--hero {
    height: 145px;
    margin-top: calc(18px + env(safe-area-inset-top));
  }

  .amount-form {
    padding-top: 14px;
  }

  .confirmation-message {
    padding-top: 36px;
    padding-bottom: 24px;
  }

  .confirmation-message h1 {
    margin-top: 24px;
  }

  .success-message {
    padding-top: calc(35px + env(safe-area-inset-top));
    padding-bottom: 24px;
  }

  .hexagon--success {
    width: 82px;
    height: 92px;
  }
}

@media (min-width: 481px) {
  body {
    padding: 20px 0;
  }

  .app-shell,
  .screen,
  .screen__content,
  .amount-layout,
  .success-layout {
    min-height: calc(100dvh - 40px);
  }

  .app-shell {
    border-radius: 24px;
  }

  .confirmation-layout {
    min-height: calc(100dvh - 98px - env(safe-area-inset-top));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
