@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Noto+Sans+Thai:wght@400;500;600;700&display=swap');

:root {
  --ink: #10233e;
  --muted: #708099;
  --line: #e8edf4;
  --primary: #1677ff;
  --primary-dark: #075ecc;
  --accent: #12b8a6;
  --surface: #ffffff;
  --soft: #f6f8fb;
  --danger: #e14d4d;
  --warning-bg: #fff9e9;
  --warning-line: #f5e5a7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Manrope", "Noto Sans Thai", sans-serif;
  background:
    radial-gradient(circle at 8% 10%, rgba(24, 119, 255, .14), transparent 28rem),
    radial-gradient(circle at 90% 85%, rgba(18, 184, 166, .12), transparent 25rem),
    #f4f7fb;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .4;
  background-image: radial-gradient(rgba(16, 35, 62, .12) .7px, transparent .7px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

button { font: inherit; }

.page {
  position: relative;
  z-index: 1;
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: auto;
  padding: 28px 24px 40px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: #0b203b;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.4px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  padding: 8px;
  color: white;
  border-radius: 11px;
  background: linear-gradient(145deg, #1684ff, #075ecc);
  box-shadow: 0 9px 20px rgba(22, 119, 255, .25);
}

.content {
  align-self: center;
  padding: 30px 0;
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(420px, 1fr);
  align-items: center;
  gap: clamp(42px, 8vw, 96px);
}

.intro { max-width: 450px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 7px 11px;
  color: #087a70;
  border: 1px solid #c9eee9;
  border-radius: 999px;
  background: rgba(235, 251, 248, .85);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(18, 184, 166, .12);
}

h1 {
  margin: 0;
  max-width: 420px;
  font-size: clamp(38px, 5vw, 61px);
  line-height: 1.08;
  letter-spacing: -2.6px;
}

.intro p {
  margin: 22px 0 0;
  max-width: 390px;
  color: var(--muted);
  font-family: "Noto Sans Thai", sans-serif;
  font-size: 15px;
  line-height: 1.8;
}

.secure-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 30px;
  color: #52647d;
  font-size: 12px;
  font-weight: 700;
}

.secure-note svg { color: var(--accent); }

.payment-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(220, 228, 239, .92);
  border-radius: 28px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 30px 90px rgba(28, 52, 84, .14), 0 3px 12px rgba(28, 52, 84, .05);
  backdrop-filter: blur(18px);
}

.card-head {
  padding: 24px 26px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 800;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--primary);
  border-radius: 11px;
  background: #eaf3ff;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  color: #96700a;
  border-radius: 999px;
  background: #fff6d8;
  font-size: 11px;
  font-weight: 800;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e4aa0e;
}

.card-body { padding: 26px; }

.amount-wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

.label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-family: "Noto Sans Thai", sans-serif;
  font-size: 12px;
  font-weight: 500;
}

.amount {
  min-height: 52px;
  font-size: clamp(36px, 5vw, 48px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -2px;
}

.amount .currency {
  margin-left: 5px;
  color: #8090a5;
  font-family: "Noto Sans Thai", sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}

.timer-wrap { text-align: right; }

.timer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--danger);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.qr-panel {
  margin-top: 24px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  overflow: hidden;
  border: 1px solid #dbe9fb;
  border-radius: 18px;
  background: linear-gradient(135deg, #f2f7ff, #f8fbff);
}

.qr-title {
  margin: 0 0 6px;
  font-family: "Noto Sans Thai", sans-serif;
  font-size: 15px;
  font-weight: 700;
}

.qr-description {
  margin: 0;
  max-width: 190px;
  color: var(--muted);
  font-family: "Noto Sans Thai", sans-serif;
  font-size: 11px;
  line-height: 1.65;
}

.qr-channel {
  width: fit-content;
  margin-top: 13px;
  padding: 5px 8px;
  color: #1762bd;
  border-radius: 7px;
  background: #dfedff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.qr-frame {
  position: relative;
  width: 138px;
  height: 138px;
  padding: 8px;
  flex: 0 0 auto;
  border: 1px solid #e1e7ef;
  border-radius: 15px;
  background: white;
  box-shadow: 0 9px 24px rgba(30, 75, 130, .1);
}

.qr-frame.skeleton { display: block; }

.qr-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  image-rendering: pixelated;
}

.qr-canvas[hidden] { display: none; }

.bank-panel {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f7f9fc;
}

.bank-top {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 18px;
}

.bank-logo {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  color: white;
  border-radius: 15px;
  background: var(--bank-color, #1677ff);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--bank-color, #1677ff) 25%, transparent);
}

.bank-logo svg { width: 25px; height: 25px; }

.bank-name {
  font-family: "Noto Sans Thai", sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.bank-code {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
}

.account-row {
  padding-top: 15px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  border-top: 1px solid #e2e8f0;
}

.account-number {
  display: block;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .7px;
  font-variant-numeric: tabular-nums;
}

.account-name {
  margin-top: 4px;
  color: var(--muted);
  font-family: "Noto Sans Thai", sans-serif;
  font-size: 11px;
}

.copy-btn {
  width: auto;
  min-width: 92px;
  height: 42px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--primary);
  border: 1px solid #d8e7fb;
  border-radius: 12px;
  background: white;
  font-family: "Noto Sans Thai", sans-serif;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
}

.copy-btn:hover { transform: translateY(-1px); background: #edf5ff; }
.copy-btn:focus-visible, .retry-btn:focus-visible { outline: 3px solid rgba(22, 119, 255, .25); outline-offset: 2px; }

.metadata {
  margin: 20px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.meta-item { min-width: 0; }
.meta-value {
  overflow: hidden;
  color: #3e526e;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice {
  margin-top: 20px;
  padding: 13px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #766020;
  border: 1px solid var(--warning-line);
  border-radius: 14px;
  background: var(--warning-bg);
  font-family: "Noto Sans Thai", sans-serif;
  font-size: 11px;
  line-height: 1.65;
}

.notice svg { flex: 0 0 auto; margin-top: 2px; }

footer {
  color: #91a0b3;
  font-size: 10px;
  text-align: center;
  letter-spacing: .2px;
}

.skeleton {
  display: inline-block;
  color: transparent !important;
  border-radius: 7px;
  background: linear-gradient(100deg, #e8edf4 30%, #f7f9fc 50%, #e8edf4 70%);
  background-size: 300% 100%;
  animation: shimmer 1.25s infinite;
  user-select: none;
}

.error-panel {
  display: none;
  padding: 48px 28px;
  text-align: center;
}

.error-panel.is-visible { display: block; }
.payment-content.is-hidden { display: none; }

.error-icon {
  width: 48px;
  height: 48px;
  margin: auto;
  display: grid;
  place-items: center;
  color: var(--danger);
  border-radius: 15px;
  background: #fff0f0;
}

.error-panel h2 { margin: 16px 0 6px; font-size: 17px; }
.error-panel p { margin: 0; color: var(--muted); font: 12px/1.6 "Noto Sans Thai", sans-serif; }

.retry-btn {
  margin-top: 18px;
  padding: 10px 18px;
  color: white;
  border: 0;
  border-radius: 11px;
  background: var(--primary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 28px;
  padding: 11px 16px;
  color: white;
  border-radius: 12px;
  background: #10233e;
  box-shadow: 0 12px 30px rgba(16, 35, 62, .2);
  font: 12px "Noto Sans Thai", sans-serif;
  transform: translate(-50%, 20px);
  opacity: 0;
  transition: .25s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes shimmer { to { background-position-x: -300%; } }

@media (max-width: 790px) {
  .page { padding: 22px 16px 28px; }
  .content { grid-template-columns: 1fr; gap: 28px; padding: 36px 0; }
  .intro { max-width: 560px; text-align: center; margin: auto; }
  .intro h1 { max-width: 560px; }
  .intro p { max-width: 520px; margin-inline: auto; }
  .secure-note { justify-content: center; }
  .payment-card { width: min(100%, 500px); margin: auto; }
}

@media (max-width: 470px) {
  .page { display: block; }
  .content { padding-top: 30px; }
  .intro h1 { font-size: 37px; letter-spacing: -1.8px; }
  .intro p { font-size: 13px; }
  .secure-note { margin-top: 20px; }
  .payment-card { border-radius: 22px; }
  .card-head, .card-body { padding: 20px; }
  .amount-wrap { align-items: flex-end; }
  .amount { font-size: 37px; }
  .amount .currency { font-size: 14px; }
  .metadata { grid-template-columns: 1fr; gap: 10px; }
  footer { margin-top: 30px; }
}

@media (max-width: 380px) {
  .qr-panel { grid-template-columns: 1fr; text-align: center; }
  .qr-description, .qr-channel { margin-inline: auto; }
  .qr-frame { margin: auto; }
}

/* Compact centered payment layout */
.page {
  width: min(100%, 520px);
  height: 100svh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
}

.brand {
  margin-inline: auto;
  text-decoration: none;
}

.content {
  width: 100%;
  min-height: 0;
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.intro { display: none; }

.payment-card {
  width: min(100%, 470px);
  margin: auto;
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(28, 52, 84, .13), 0 2px 10px rgba(28, 52, 84, .04);
}

.card-body { padding: 22px; }

.amount-wrap {
  padding: 18px 20px;
  align-items: center;
  border: 1px solid #e4eaf2;
  border-radius: 17px;
  background: #f7f9fc;
}

.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-top: 10px;
  padding: 18px 0 2px;
  text-align: center;
  border: 0;
  background: transparent;
}

.qr-title { margin-bottom: 14px; }
.qr-description, .qr-channel { display: none; }

.qr-frame {
  width: 250px;
  height: 250px;
  padding: 10px;
  margin: auto;
  border-radius: 18px;
}

.bank-panel { margin-top: 18px; }
.metadata {
  margin-top: 17px;
  padding-top: 15px;
  grid-template-columns: 1fr;
  border-top: 1px solid #e2e8f0;
  text-align: left;
}

.meta-item:first-child { display: none; }
.notice { margin-top: 16px; }
@media (max-width: 430px) {
  .amount-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 13px;
    padding: 16px;
  }

  .timer-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .timer-wrap .label { margin-bottom: 0; }
}

@media (max-height: 900px) {
  .card-head { padding: 16px 20px; }
  .card-body { padding: 16px 20px; }

  .amount-wrap { padding: 13px 16px; }
  .amount { min-height: 43px; font-size: 40px; }

  .qr-panel { margin-top: 6px; padding-top: 10px; }
  .qr-title { margin-bottom: 8px; }
  .qr-frame { width: 215px; height: 215px; padding: 8px; }

  .bank-panel { margin-top: 12px; padding: 15px; }
  .bank-top { margin-bottom: 12px; }
  .bank-logo { width: 42px; height: 42px; border-radius: 13px; }
  .account-row { padding-top: 11px; }
  .account-number { font-size: 19px; }
  .metadata { margin-top: 11px; padding-top: 10px; }
  .notice { margin-top: 11px; padding: 9px 12px; }
}

@media (max-height: 760px) {
  .page { padding-block: 8px; }
  .card-head { padding: 12px 18px; }
  .card-icon { width: 32px; height: 32px; }
  .card-body { padding: 11px 16px; }

  .amount-wrap { padding: 10px 13px; }
  .amount { min-height: 37px; font-size: 34px; }
  .timer { font-size: 16px; }

  .qr-panel { padding-top: 6px; }
  .qr-title { margin-bottom: 5px; font-size: 13px; }
  .qr-frame {
    width: min(190px, 26svh);
    height: min(190px, 26svh);
    padding: 7px;
  }

  .bank-panel { margin-top: 8px; padding: 11px 13px; }
  .bank-top { gap: 10px; margin-bottom: 8px; }
  .bank-logo { width: 38px; height: 38px; }
  .bank-logo svg { width: 21px; height: 21px; }
  .account-row { padding-top: 8px; }
  .account-name { margin-top: 2px; }
  .copy-btn { height: 36px; }
  .metadata { margin-top: 8px; padding-top: 7px; }
  .notice { margin-top: 8px; padding: 7px 10px; line-height: 1.45; }
}

@media (max-width: 380px) {
  .page { padding-inline: 12px; }
  .qr-frame { width: min(218px, 26svh); height: min(218px, 26svh); }
  .account-row { grid-template-columns: 1fr; }
  .copy-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}
