@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/Manrope-VF.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Unbounded";
  src: url("/static/fonts/Unbounded-VF.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --bg: #0b0816;
  --bg-2: #120c24;
  --card: rgba(26, 18, 48, 0.72);
  --card-border: rgba(134, 110, 167, 0.28);
  --text: #ece6fa;
  --muted: #a99cc4;
  --accent: #8a2be2;
  --accent-2: #a45cf0;
  --lavender: #866ea7;
  --lavender-light: #cbb8ee;
  --ok: #6fe3a4;
  --bad: #ff7d93;
  --warn: #ffd27a;
  --radius: 18px;
  --head: "Unbounded", "Manrope", system-ui, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--body);
  overflow-x: hidden;
}
[hidden] { display: none !important; }
img { display: block; }
b { font-weight: 700; }
h1, h2 { font-family: var(--head); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }

/* ---------- night sky ---------- */
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background: radial-gradient(120% 80% at 50% -10%, #23154a 0%, var(--bg-2) 40%, var(--bg) 75%); }
.stars { position: absolute; inset: -50%; background-repeat: repeat; }
.s1 {
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 120px 80px, #e6dcff, transparent),
    radial-gradient(1.5px 1.5px at 200px 160px, #fff, transparent),
    radial-gradient(1px 1px at 60px 200px, #cbb8ee, transparent),
    radial-gradient(1px 1px at 260px 40px, #fff, transparent);
  background-size: 300px 240px; opacity: .55;
  animation: twinkle 6s ease-in-out infinite alternate;
}
.s2 {
  background-image:
    radial-gradient(1.5px 1.5px at 80px 120px, #fff, transparent),
    radial-gradient(1px 1px at 330px 60px, #cbb8ee, transparent),
    radial-gradient(2px 2px at 400px 300px, #e6dcff, transparent),
    radial-gradient(1px 1px at 180px 340px, #fff, transparent);
  background-size: 460px 400px; opacity: .4;
  animation: twinkle 9s ease-in-out infinite alternate-reverse;
}
.glow { position: absolute; width: 520px; height: 520px; left: 50%; top: -140px; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(138, 43, 226, .28), transparent 65%); filter: blur(10px); }
@keyframes twinkle { from { opacity: .25; } to { opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .stars { animation: none; } }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px max(16px, env(safe-area-inset-left)); max-width: 960px; width: 100%; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none;
  font: 600 18px var(--head); }
.brand img { border-radius: 9px; }
.user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--card-border); background: var(--bg-2); }
.user-name { font-weight: 600; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-link { background: none; border: 0; color: var(--lavender-light); font: 600 14px var(--body); cursor: pointer;
  padding: 6px 4px; border-radius: 8px; }
.btn-link:hover { color: #fff; }

/* ---------- layout ---------- */
.wrap { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 16px 40px; display: grid; gap: 20px; }

.hero { position: relative; text-align: center; padding: 28px 0 8px; display: grid; gap: 14px; justify-items: center; }
.moon { width: 96px; height: 96px; border-radius: 50%; margin-bottom: 6px;
  background: radial-gradient(circle at 34% 32%, #f3edff 0%, #cbb8ee 38%, #866ea7 72%, #5a3d86 100%);
  box-shadow: inset -14px -10px 0 0 rgba(11, 8, 22, .55), 0 0 40px 6px rgba(138, 43, 226, .45), 0 0 120px 30px rgba(134, 110, 167, .2);
  animation: float 7s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .moon { animation: none; } }
.eyebrow { color: var(--lavender-light); font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h1 { font-size: clamp(26px, 7.4vw, 42px); line-height: 1.15;
  background: linear-gradient(180deg, #fff 20%, #cbb8ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); max-width: 30em; font-size: 16px; }
.lead b { color: var(--text); }
.hint { color: var(--muted); font-size: 13px; margin-top: 12px; max-width: 26em; }
#login-box { display: grid; justify-items: center; margin-top: 6px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px;
  border: 0; border-radius: 14px; font: 700 16px var(--body); text-decoration: none; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease; -webkit-tap-highlight-color: transparent; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent) 60%, #6a1fb5);
  box-shadow: 0 8px 28px -8px rgba(138, 43, 226, .8), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 10px 34px -6px rgba(138, 43, 226, .95), inset 0 1px 0 rgba(255,255,255,.2); }
.btn-primary:active { transform: translateY(1px) scale(.99); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn-wide { width: 100%; }
:focus-visible { outline: 2px solid var(--lavender-light); outline-offset: 3px; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 20px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 20px 60px -30px rgba(0, 0, 0, .8); }
.card h2 { font-size: 18px; margin-bottom: 14px; }

.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.preset { min-height: 48px; border-radius: 12px; border: 1px solid var(--card-border); background: rgba(134, 110, 167, .1);
  color: var(--text); font: 700 15px var(--body); cursor: pointer; transition: background .15s, border-color .15s; }
.preset:hover { border-color: var(--lavender); }
.preset[aria-pressed="true"] { background: rgba(138, 43, 226, .3); border-color: var(--accent-2);
  box-shadow: 0 0 0 1px var(--accent-2) inset, 0 0 18px -4px rgba(138, 43, 226, .8); }

.field { display: grid; gap: 6px; margin-top: 16px; }
.field > span:first-child { font-size: 13px; color: var(--muted); font-weight: 600; }
.input-wrap { position: relative; display: block; }
.input-wrap input { width: 100%; min-height: 50px; padding: 0 44px 0 16px; border-radius: 12px; border: 1px solid var(--card-border);
  background: rgba(11, 8, 22, .6); color: var(--text); font: 600 17px var(--body); }
.input-wrap input::placeholder { color: #6e6386; font-weight: 500; }
.input-wrap input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(138, 43, 226, .3); }
.suffix { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--lavender-light); pointer-events: none; }

.total { margin: 16px 0 14px; font-size: 16px; }
.total b { font-family: var(--head); font-weight: 600; }
.total .muted { font-size: 13px; display: inline-block; }
.error { color: var(--bad); font-size: 14px; margin-bottom: 12px; }

.notice { width: 100%; padding: 12px 16px; border-radius: 12px; font-size: 14px; border: 1px solid rgba(255, 210, 122, .35);
  background: rgba(255, 210, 122, .08); color: var(--warn); }
.notice.bad { border-color: rgba(255, 125, 147, .35); background: rgba(255, 125, 147, .08); color: var(--bad); }

/* ---------- status ---------- */
.status-card { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; }
.status-card h2 { margin-bottom: 4px; font-size: 16px; }
.status-icon { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(203, 184, 238, .25);
  border-top-color: var(--lavender-light); animation: spin 1s linear infinite; }
.status-card.paid .status-icon { animation: none; border: 0; background: var(--ok); box-shadow: 0 0 20px rgba(111, 227, 164, .5);
  -webkit-mask: none; position: relative; }
.status-card.paid .status-icon::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #0b0816; font-weight: 800; }
.status-card.failed .status-icon { animation: none; border: 0; background: var(--bad); position: relative; }
.status-card.failed .status-icon::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; color: #0b0816; font-weight: 800; }
.status-card.paid { border-color: rgba(111, 227, 164, .4); }
.status-card.failed { border-color: rgba(255, 125, 147, .4); }
.close { font-size: 16px; line-height: 1; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- uses ---------- */
.uses h2 { font-size: 18px; margin: 8px 0 14px; text-align: center; }
.uses-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.uses-grid li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px;
  background: rgba(26, 18, 48, .45); border: 1px solid rgba(134, 110, 167, .18); }
.uses-grid .ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 18px;
  color: var(--lavender-light); background: rgba(138, 43, 226, .18); box-shadow: inset 0 0 0 1px rgba(164, 92, 240, .3); }
.uses-grid b { display: block; margin-bottom: 2px; }
.uses-grid p { color: var(--muted); font-size: 14px; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(134, 110, 167, .14); }

@media (min-width: 560px) {
  .presets { grid-template-columns: repeat(5, 1fr); }
  .uses-grid { grid-template-columns: 1fr 1fr; }
  .uses-grid li:last-child { grid-column: 1 / -1; }
  .card { padding: 26px; }
  .hero { padding-top: 40px; }
  .moon { width: 120px; height: 120px; }
}
