:root {
  --bg: #F5F5F7;
  --card: #FFFFFF;
  --ink: #1D1D1F;
  --muted: #6E6E73;
  --line: #E5E5EA;
  --field: #F2F2F7;
  --accent: #FF5F1F;
  --primary: #111111;
  --primary-ink: #FFFFFF;
  --green: #34C759;
  --red: #FF3B30;
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1C1C1E;
    --ink: #F5F5F7;
    --muted: #98989D;
    --line: #2C2C2E;
    --field: #2C2C2E;
    --primary: #F5F5F7;
    --primary-ink: #000000;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
body.embed { background: transparent; }

.wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
body.embed .wrap { justify-content: center; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 16px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand img { border-radius: 9px; }
.close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--field);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 40px rgba(0, 0, 0, .06);
}
body.embed .card { box-shadow: 0 24px 80px rgba(0, 0, 0, .25); }

.view { display: none; }
.view.active { display: block; animation: rise .28s ease both; }
.view.center { text-align: center; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.summary { margin-bottom: 22px; }
.label { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.amount { margin: 2px 0 2px; font-size: 44px; font-weight: 700; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.purpose { margin: 0; color: var(--muted); font-size: 15px; }

h2 { margin: 14px 0 6px; font-size: 21px; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; margin: 8px 0 0; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px 2px; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--field);
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 13px 14px;
  outline: none;
  transition: border-color .15s, background .15s;
}
input:focus { border-color: var(--accent); background: var(--card); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  border: 0;
  font: 600 16px var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.secondary { background: var(--field); color: var(--ink); margin-top: 10px; }
.btn.app { background: var(--field); color: var(--ink); margin-bottom: 8px; justify-content: space-between; }
.btn.app::after { content: "›"; font-size: 22px; color: var(--muted); }
.btn.app:first-child { background: var(--primary); color: var(--primary-ink); }
.btn.app:first-child::after { color: inherit; opacity: .6; }
.btn.small { min-height: 44px; width: auto; margin: 0; }

.link {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: 0;
  color: var(--accent);
  font: 500 14px var(--font);
  cursor: pointer;
}

.qr-block { text-align: center; }
.qr {
  display: inline-block;
  padding: 14px;
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--line);
}
.qr img { display: block; width: 220px; height: 220px; image-rendering: pixelated; }
.hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

.note { margin: 18px 0 4px; padding: 14px; background: var(--field); border-radius: 14px; font-size: 14px; }
.note p { margin: 0; }
.note p + p { margin-top: 4px; font-size: 12.5px; }

.timer { margin: 12px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.error { color: var(--red); font-size: 14px; margin: -4px 0 12px 2px; }

.spinner {
  width: 44px; height: 44px; margin: 6px auto 0;
  border-radius: 50%;
  border: 3.5px solid var(--line);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
[data-view="verifying"] { text-align: center; }

.utr { margin: 18px 0 0; text-align: left; background: var(--field); border-radius: 14px; padding: 12px 14px; }
.utr summary { cursor: pointer; font-size: 14px; font-weight: 500; }
.utr form { display: flex; gap: 8px; margin-top: 10px; }
.utr input { background: var(--card); }

.check { width: 72px; height: 72px; margin: 4px auto 0; }
.check svg { width: 72px; height: 72px; }
.check circle { fill: var(--green); }
.check path { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s .15s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
[data-view="paid"] .btn { margin-top: 10px; }
[data-view="paid"] h2 { margin-top: 16px; }

.icon-muted {
  width: 56px; height: 56px; margin: 4px auto 0; border-radius: 50%;
  background: var(--field); color: var(--muted); font: 700 28px/56px var(--font);
}

.skeleton { height: 14px; border-radius: 8px; background: var(--field); margin-bottom: 12px; animation: pulse 1.2s ease-in-out infinite; }
.skeleton.tall { height: 40px; }
.w40 { width: 40%; } .w55 { width: 55%; } .w70 { width: 70%; }
@keyframes pulse { 50% { opacity: .5; } }

.foot { margin-top: auto; padding-top: 22px; text-align: center; font-size: 12px; color: var(--muted); }
body.embed .foot { margin-top: 0; color: rgba(255, 255, 255, .8); }
.lock::before { content: "\1F512"; font-size: 11px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } .check path { stroke-dashoffset: 0; } }
