:root {
  --bg: #1A1D16;
  --surface: #2C3025;
  --text: #F5F7F0;
  --muted: #8a9480;
  --border: rgba(255, 255, 255, 0.08);
  --lime: #BAEF5B;
  --lime-text: #1A1D16;
  --warn: #F2C14E;
  --bad: #F2765A;
  color-scheme: dark;
}

/* Light: chosen with the toggle (data-theme), or the phone's setting when nothing is chosen */
:root[data-theme="light"] {
  --bg: #F5F7F0;
  --surface: #FFFFFF;
  --text: #1A1D16;
  --muted: #4A5240;
  --border: rgba(26, 29, 22, 0.14);
  --lime: #6BA528;
  --lime-text: #FFFFFF;
  --warn: #9A6B00;
  --bad: #B23A1E;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F5F7F0;
    --surface: #FFFFFF;
    --text: #1A1D16;
    --muted: #4A5240;
    --border: rgba(26, 29, 22, 0.14);
    --lime: #6BA528;
    --lime-text: #FFFFFF;
    --warn: #9A6B00;
    --bad: #B23A1E;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  justify-content: center;
  padding: 16px;
}

.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-self: flex-start;
}

.brand { color: var(--lime); font-weight: 700; letter-spacing: 0.04em; font-size: 13px; text-transform: uppercase; }
h1 { margin: 4px 0 0; font-size: 22px; }
.sub, .muted, .fine { color: var(--muted); }
.fine { font-size: 13px; margin: 12px 0 0; }

.hold { font-size: 15px; margin-bottom: 14px; }
.hold strong { font-size: 18px; }

.status { display: flex; flex-direction: column; gap: 8px; }
.status .big { font-size: 24px; font-weight: 700; }
.status.ok .big { color: var(--lime); }
.status.warn .big { color: var(--warn); }
.status.bad .big { color: var(--bad); }

.countdown { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--lime); }

.btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  background: var(--lime);
  color: var(--lime-text);
}
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn + .btn { margin-top: 10px; }

.receipt { border-top: 1px dashed var(--border); padding-top: 12px; display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 14px; }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; text-align: right; }

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--lime);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
footer a { color: var(--muted); }
#buttons > div + div { margin-top: 10px; }

.amounts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.amounts button {
  appearance: none;
  border: 2px solid var(--lime);
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-size: 26px;
  font-weight: 800;
  padding: 22px 8px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.amounts button:active { background: var(--lime); color: var(--lime-text); }
.amounts button:only-child, .amounts button:last-child:nth-child(odd) { grid-column: 1 / -1; }

.link {
  appearance: none; border: 0; background: none; padding: 10px 0 0;
  color: var(--muted); text-decoration: underline; font-size: 14px; cursor: pointer;
}

/* Stripe methods as their own buttons, sized like PayPal's (48 px, 4 px corners, 10 px apart) */
.pm-btn {
  appearance: none; border: 0; border-radius: 4px; width: 100%; height: 48px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 17px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; cursor: pointer;
}
.pm-btn:disabled { opacity: 0.6; }
.pm-cashapp { background: #00D64F; color: #fff; }
.pm-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border-radius: 6px; background: #fff; color: #00D64F; font-weight: 800;
}
.pm-amazon { background: #FFD814; color: #0F1111; font-weight: 400; }
.pm-amazon b { font-weight: 800; }
.pm-card { background: #E4E6E1; color: #1A1D16; }
.card-form { margin-top: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; }
.card-form .btn { margin-top: 14px; }
#stripe-error:empty { display: none; }

header { position: relative; }
.theme-toggle {
  position: absolute; top: -6px; right: -6px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 50%; background: transparent;
  color: var(--muted); cursor: pointer; padding: 0;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
:root[data-theme-now="dark"] .theme-toggle .sun { display: block; }
:root[data-theme-now="dark"] .theme-toggle .moon { display: none; }
:root[data-theme-now="light"] .pm-card { border: 1px solid var(--border); }
