:root {
  color-scheme: dark;
  --bg: #090b10;
  --bg-raise: rgba(18, 21, 28, 0.92);
  --card: #141821;
  --tile: #1a2030;
  --tile-press: #242b3d;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f6fb;
  --muted: #8e97ab;
  --gold: #f3d27a;
  --mint: #3dd68c;
  --danger: #ff8d7a;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 50% -80px, rgba(61, 214, 140, 0.14), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.4 ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }

.page {
  width: min(1040px, calc(100% - 28px));
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 0 calc(28px + env(safe-area-inset-bottom));
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: #12151c;
  box-shadow: inset 0 0 0 1px var(--line);
}
.pill {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
  border: 1px solid rgba(243, 210, 122, 0.35);
  border-radius: 999px;
  padding: 5px 9px;
}

.hero {
  display: grid;
  gap: 16px;
}
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(61, 214, 140, 0.65);
  animation: pulse 1.8s ease-out infinite;
}
.timer {
  margin-left: auto;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.bar {
  height: 3px;
  margin-top: 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--mint), var(--gold));
}
.merchant {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.amount {
  margin: 2px 0 0;
  font-size: clamp(34px, 9vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}
.lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.qr-panel {
  display: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.qr-panel.open { display: block; }
.qr-panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 650;
}
.qr-box {
  width: fit-content;
  margin: 0 auto;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
}
.qr-box img, .qr-box canvas { display: block; }
.steps {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.steps li {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
.steps b {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 99px;
  display: grid;
  place-items: center;
  background: #222838;
  color: var(--text);
  font-size: 12px;
}

.qr-toggle, .btn, .copy {
  border: 0;
  border-radius: 14px;
  min-height: 48px;
  padding: 0 16px;
  background: #222838;
  color: var(--text);
  font-weight: 650;
}
.qr-toggle { width: 100%; margin-top: 14px; }
.btn-primary, .qr-toggle[aria-expanded="true"] {
  background: var(--gold);
  color: #1a1406;
}
.btn-primary:active, .qr-toggle:active, .copy:active { transform: translateY(1px); }

.tools { margin-top: 18px; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
}
.search svg { flex: none; color: var(--muted); }
.search input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  padding: 12px 0;
}
.search input::placeholder { color: #6d768a; }
.count {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.bank {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 108px;
  padding: 12px 8px 10px;
  border-radius: 16px;
  background: var(--tile);
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--text);
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.bank:active { background: var(--tile-press); }
.bank:focus-visible, .qr-toggle:focus-visible, .btn:focus-visible, .copy:focus-visible, .search input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.bank.recent { box-shadow: inset 0 0 0 1px rgba(243, 210, 122, 0.55); }
.logo, .initials {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #fff;
}
.logo { object-fit: contain; padding: 5px; }
.initials {
  display: grid;
  place-items: center;
  background: #2a3144;
  color: var(--gold);
  font-size: 14px;
  font-weight: 750;
}
.bank-name {
  font-size: 12px;
  line-height: 1.25;
  font-weight: 620;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}

.hint, .empty, .noscript {
  color: var(--muted);
  font-size: 13px;
}
.hint { margin: 16px 4px 0; }
.empty {
  grid-column: 1 / -1;
  padding: 28px 8px;
  text-align: center;
}

.banner {
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom));
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #222838;
  border: 1px solid var(--line);
  font-size: 14px;
}

.page.is-expired .dot { background: var(--danger); animation: none; box-shadow: none; }
.page.is-expired .timer, .page.is-expired .amount { color: var(--danger); }
.page.is-expired .bank { opacity: 0.45; pointer-events: none; }

.landing {
  width: min(560px, calc(100% - 32px));
  margin: 12vh auto 40px;
}
.landing h1 {
  margin: 18px 0 8px;
  font-size: 32px;
  letter-spacing: -0.04em;
}
.landing p { color: var(--muted); }
.card {
  margin-top: 22px;
  padding: 16px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
}
.card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.card textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0d1016;
  color: var(--text);
  padding: 12px;
  font: 14px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.result {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #0d1016;
  word-break: break-all;
  font: 13px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.form-error { color: var(--danger); font-size: 13px; margin: 8px 0 0; }

@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: center;
    gap: 28px;
  }
  .qr-panel { display: block; }
  .qr-toggle { display: none; }
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .dot { animation: none; }
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(61, 214, 140, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 214, 140, 0); }
}
