:root {
  --pay-bg: #f2f2f1;
  --paper: #ffffff;
  --ink: rgba(0, 0, 0, 0.85);
  --muted: rgba(0, 0, 0, 0.56);
  --faint: rgba(0, 0, 0, 0.45);
  --line: rgba(0, 0, 0, 0.1);
  --accent: #4060f0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--pay-bg);
  color: var(--ink);
  font-family: Roboto, "Roboto Flex", system-ui, sans-serif;
}

.pay {
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.receipt {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

.receipt__slot {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  z-index: 4;
  pointer-events: none;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.28),
    0 8px 20px rgba(0, 0, 0, 0.2);
}

.receipt__paper {
  position: relative;
  background: var(--paper);
}

.receipt__paper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.05) 40%, transparent);
}

.receipt__body {
  padding: 16px 24px 10px;
}

.receipt__head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 14px;
}

.receipt__head img {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
}

.receipt__head span {
  color: #111;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.receipt__info h1 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #111;
}

.receipt__rows { margin: 0; }

.receipt__row {
  display: grid;
  grid-template-columns: minmax(8.2rem, 0.95fr) minmax(0, 1.2fr);
  gap: 8px 12px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dotted rgba(0, 0, 0, 0.2);
}

.receipt__row dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.receipt__row dd {
  margin: 0;
  color: #111;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

.receipt__hints {
  margin: 12px 4px 0;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
}

.receipt__hints p { margin: 0 0 8px; }
.receipt__hints p:last-child {
  margin: 0;
  font-weight: 500;
}

.receipt__qr {
  display: grid;
  place-items: center;
  min-height: 188px;
  padding: 10px 0 4px;
}

.receipt__qr img {
  width: 188px;
  height: 188px;
  display: block;
}

.receipt__wait {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 188px;
  padding: 8px 16px;
  text-align: center;
}

.receipt__qr.is-wait .receipt__wait { display: flex; }
.receipt__qr.is-wait img { display: none; }

.receipt__wait p {
  margin: 0;
  max-width: 16rem;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.receipt__spin {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(64, 96, 240, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: receipt-spin 0.75s linear infinite;
}

@keyframes receipt-spin {
  to { transform: rotate(360deg); }
}

.receipt__cut {
  position: relative;
  height: 16px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.receipt__cut i {
  position: absolute;
  top: -6px;
  left: 56px;
  width: 12px;
  height: 12px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}

.receipt__foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px 16px;
  background: var(--paper);
}

.receipt__legal {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.receipt__logo {
  width: 36px;
  height: 36px;
  flex: none;
  object-fit: contain;
  border-radius: 8px;
}

.receipt__offer {
  margin: 0;
  max-width: 9.5rem;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.receipt__offer a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.receipt__brand {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}

.receipt__brand span {
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
}

.receipt__brand a {
  color: var(--accent);
  font-size: 11px;
  line-height: 1.3;
  text-decoration: none;
}

.receipt__brand a:hover { text-decoration: underline; }

.receipt__tear {
  height: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath fill='%23ffffff' d='M0 0h16v2L8 10 0 2z'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center top;
  background-size: 14px 8px;
}

.m-pay,
.m-wait,
.m-banks { display: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html[data-view="mobile"],
html[data-view="mobile"] body {
  height: auto;
  min-height: 100%;
  overflow: auto;
  background: #fff;
}

html[data-view="mobile"] .pay { display: none; }

html[data-view="mobile"] .m-pay {
  display: block;
  width: min(27.5rem, 100%);
  margin: 0 auto;
  padding: 28px 20px 32px;
}

.m-pay__head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 22px;
}

.m-pay__head img {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: contain;
}

.m-pay__head span {
  color: #111;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.m-pay__title {
  margin: 0 0 18px;
  color: #111;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-align: center;
}

.m-pay__info h2,
.m-pay__banks h2 {
  margin: 0 0 8px;
  color: #111;
  font-size: 18px;
  font-weight: 600;
}

.m-pay__info dl { margin: 0 0 22px; }

.m-pay__info dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed #e6e8ed;
}

.m-pay__info dt {
  color: var(--muted);
  font-size: 13px;
}

.m-pay__info dd {
  margin: 0;
  color: #111;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.m-pay__popular {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 14px;
}

.m-pay__pick {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid #e6e8ed;
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.m-pay__pick:active { background: #f5f7ff; }

.m-pay__pick .m-pay__bank-logo {
  width: 40px;
  height: 40px;
  margin: 0 12px 0 0;
  border-radius: 10px;
}

.m-pay__pick .m-pay__bank-name {
  color: #111;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
}

.m-pay__all {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.m-pay__all:active { background: #eef1ff; }

.m-pay__search { display: block; margin: 0 16px 8px; flex: none; }

.m-pay__search input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #e6e8ed;
  border-radius: 8px;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 15px;
  outline: none;
}

.m-pay__search input:focus { border-color: var(--accent); }

.m-pay__status {
  padding: 8px 20px 4px;
  color: var(--muted);
  font-size: 14px;
}

.m-pay__status[hidden] { display: none; }

.m-pay__bank {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e6e8ed;
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.m-pay__bank + .m-pay__bank { margin-top: 8px; }
.m-pay__bank:active { background: #f5f7ff; }

.m-pay__bank-logo {
  width: 44px;
  height: 44px;
  margin-right: 14px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: #eef1f5;
}

.m-pay__bank-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.m-pay__bank-name {
  color: #111;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
}

html[data-view="mobile"] .m-banks,
html:not([data-view="desktop"]) .m-banks {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 15;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px 16px;
  background: rgba(17, 24, 48, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

html[data-view="mobile"] .m-banks.is-on,
html:not([data-view="desktop"]) .m-banks.is-on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.m-banks__panel {
  display: flex;
  flex-direction: column;
  width: min(27.5rem, 100%);
  height: min(86dvh, 640px);
  max-height: min(86dvh, 640px);
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(17, 24, 48, 0.18);
  transform: translateY(28px);
  transition: transform 0.32s ease;
}

html[data-view="mobile"] .m-banks.is-on .m-banks__panel,
html:not([data-view="desktop"]) .m-banks.is-on .m-banks__panel {
  transform: translateY(0);
}

.m-banks__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px 10px 20px;
}

.m-banks__head h2 {
  margin: 0;
  color: #111;
  font-size: 20px;
  font-weight: 700;
  line-height: 36px;
}

.m-banks__head button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: #f3f4f8;
  color: #111;
  cursor: pointer;
}

.m-banks__head button svg {
  display: block;
}

.m-banks__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 12px;
  -webkit-overflow-scrolling: touch;
}

.m-pay__foot {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.m-pay__foot p { margin: 0 0 8px; }
.m-pay__foot a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.m-pay__foot p:last-child a { color: var(--accent); text-decoration: none; }

html[data-view="mobile"] .m-wait,
html:not([data-view="desktop"]) .m-wait {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 20;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(17, 24, 48, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

html[data-view="mobile"] .m-wait.is-on,
html:not([data-view="desktop"]) .m-wait.is-on {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.m-wait__card {
  width: min(22rem, 100%);
  padding: 24px 20px 20px;
  border-radius: 16px;
  background: #fff;
  text-align: center;
  transform: translateY(16px) scale(0.96);
  transition: transform 0.32s ease;
}

html[data-view="mobile"] .m-wait.is-on .m-wait__card,
html:not([data-view="desktop"]) .m-wait.is-on .m-wait__card {
  transform: none;
}

.m-wait__logo {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  overflow: hidden;
  border-radius: 16px;
  background: transparent;
}

.m-wait__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.m-wait__logo img[hidden] {
  display: none;
}

.m-wait__card .m-wait__spin,
.m-wait__card .receipt__spin {
  display: block;
  margin: 14px auto 16px;
}

.m-wait__card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111;
}

.m-wait__card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.m-wait__card button {
  min-height: 42px;
  padding: 8px 18px;
  border: 1px solid #e6e8ed;
  border-radius: 8px;
  background: #fff;
  color: #111;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

@media (max-width: 720px) {
  html:not([data-view="desktop"]),
  html:not([data-view="desktop"]) body {
    height: auto;
    min-height: 100%;
    overflow: auto;
    background: #fff;
  }
  html:not([data-view="desktop"]) .pay { display: none; }
  html:not([data-view="desktop"]) .m-pay {
    display: block;
    width: min(27.5rem, 100%);
    margin: 0 auto;
    padding: 28px 20px 32px;
  }
  html:not([data-view="desktop"]) .m-wait {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 20;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(17, 24, 48, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
  }
  html:not([data-view="desktop"]) .m-wait.is-on {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}
