:root {
  --bg: #050506;
  --bg-elev: #0c0c0e;
  --bg-card: #111114;
  --border: #1f1f24;
  --border-strong: #2a2a32;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --crimson: #e11d48;
  --crimson-soft: #fb7185;
  --crimson-deep: #9f1239;
  --danger: #f87171;
  --ok: #fb7185;
  --radius: 14px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
body {
  background:
    radial-gradient(900px 420px at 15% -10%, rgba(225, 29, 72, 0.16), transparent 55%),
    radial-gradient(700px 380px at 90% 0%, rgba(159, 18, 57, 0.1), transparent 50%),
    var(--bg);
}

a { color: var(--crimson-soft); text-decoration: none; }
a:hover { color: #fff; }

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  width: 100%;
}

/* ——— Animated B4U.FO wordmark ——— */
.logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  user-select: none;
}
.logo-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.logo-text {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: baseline;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 0.92;
  font-size: 1.85rem;
}
.logo-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto 20px;
  padding: 4px 4px 10px;
  animation: logoFloat 5.5s ease-in-out infinite;
}
.logo-auth .logo-text {
  /* ~25% smaller than prior clamp(2.75rem, 9vw, 4.35rem) */
  font-size: clamp(2.05rem, 6.75vw, 3.25rem);
  letter-spacing: 0.07em;
}
.logo-auth .logo-underline {
  display: block;
  width: min(68%, 168px);
  height: 2.5px;
  margin-top: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--crimson-soft), #fff, var(--crimson), transparent);
  background-size: 200% 100%;
  animation: logoLine 2.8s ease-in-out infinite;
  box-shadow: 0 0 14px rgba(225, 29, 72, 0.5);
}
.logo-top .logo-text { font-size: 1.25rem; letter-spacing: 0.07em; }
.logo-auth .logo-glow {
  inset: -20px -36px;
}

.logo-ch,
.logo-dot {
  display: inline-block;
  background: linear-gradient(
    110deg,
    #fff 0%,
    #ffe4e6 14%,
    var(--crimson-soft) 32%,
    #fff 48%,
    var(--crimson) 68%,
    #fda4af 86%,
    #fff 100%
  );
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation:
    logoShimmer 3.6s ease-in-out infinite,
    logoRise 0.85s cubic-bezier(0.22, 1, 0.36, 1) both,
    logoGlowPulse 2.8s ease-in-out infinite;
  animation-delay:
    calc(var(--i) * 90ms),
    calc(var(--i) * 90ms),
    calc(var(--i) * 120ms);
  filter: drop-shadow(0 0 10px rgba(225, 29, 72, 0.45))
          drop-shadow(0 0 28px rgba(225, 29, 72, 0.28));
  transform-origin: center bottom;
}
.logo-auth .logo-ch,
.logo-auth .logo-dot {
  text-shadow: none;
}
.logo-dot {
  opacity: 0.9;
  margin: 0 0.04em;
  font-weight: 700;
}
.logo-glow {
  position: absolute;
  inset: -28px -48px;
  background:
    radial-gradient(circle at 50% 45%, rgba(225, 29, 72, 0.42), transparent 58%),
    radial-gradient(circle at 30% 60%, rgba(251, 113, 133, 0.18), transparent 50%);
  filter: blur(12px);
  opacity: 0.85;
  animation: logoPulse 3s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes logoShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes logoRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.88);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}
@keyframes logoPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.08); }
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes logoLine {
  0%, 100% { background-position: 0% 50%; opacity: 0.55; transform: scaleX(0.92); }
  50% { background-position: 100% 50%; opacity: 1; transform: scaleX(1); }
}
@keyframes logoGlowPulse {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(225, 29, 72, 0.35))
            drop-shadow(0 0 22px rgba(225, 29, 72, 0.2));
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(251, 113, 133, 0.65))
            drop-shadow(0 0 36px rgba(225, 29, 72, 0.4));
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-ch, .logo-dot, .logo-glow, .logo-auth, .logo-underline { animation: none !important; }
  .logo-ch, .logo-dot {
    background: linear-gradient(90deg, #fff, var(--crimson-soft), var(--crimson));
    background-size: 100% 100%;
  }
}

.card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 40%), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 28px 26px 24px;
}

.card h1 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.card .sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
.field input {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 13px;
  font-size: 16px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: rgba(225, 29, 72, 0.7);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform .12s, filter .12s, background .12s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #f43f5e, var(--crimson-deep));
  color: #fff;
  box-shadow: 0 10px 24px rgba(225, 29, 72, 0.28);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }

.stack { display: grid; gap: 10px; margin-top: 8px; }
.foot {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.status {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.35;
}
.status.show { display: block; }
.status-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}
.status-ok {
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.35);
  color: #fecdd3;
}

.dash {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 12, 14, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .left { display: flex; align-items: center; gap: 10px; }
.topbar .user {
  color: var(--muted);
  font-size: 0.9rem;
}
.topbar .user strong { color: var(--text); font-weight: 600; }
.topbar .btn { width: auto; padding: 8px 12px; font-size: 0.85rem; }

.dash-main {
  display: grid;
  place-items: center;
  padding: 40px 20px;
  flex: 1 1 auto;
  width: 100%;
}
.blank {
  max-width: 520px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 42px 28px;
  background: rgba(17, 17, 20, 0.7);
}
.blank h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.blank p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}


/* ——— Captcha widget ——— */
.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.cap {
  margin: 6px 0 16px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-elev);
}
.cap-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 4px 2px;
  text-align: left;
  font: inherit;
}
.cap-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  background: #0a0a0c;
  flex: 0 0 auto;
  position: relative;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.cap[data-state="work"] .cap-check {
  border-color: rgba(225, 29, 72, 0.7);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.15);
  animation: capSpin 0.9s linear infinite;
}
.cap[data-state="ok"] .cap-check {
  border-color: var(--crimson);
  background: linear-gradient(145deg, #f43f5e, var(--crimson-deep));
}
.cap[data-state="ok"] .cap-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.cap-label { font-weight: 600; font-size: 0.95rem; }
.cap-meta { margin-top: 10px; }
.cap-bar {
  height: 3px;
  border-radius: 999px;
  background: #1a1a1f;
  overflow: hidden;
}
.cap-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--crimson-deep), var(--crimson-soft));
  transition: width .2s ease;
}
.cap-status {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.cap[data-state="err"] .cap-status { color: #fecaca; }
.cap[data-state="ok"] .cap-status { color: #fda4af; }
@keyframes capSpin {
  to { transform: rotate(360deg); }
}

/* ——— Mobile-first auth (majority of users) ——— */
@media (max-width: 640px) {
  .shell {
    align-items: start;
    padding-top: max(28px, env(safe-area-inset-top));
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
  .shell > div {
    width: 100%;
    max-width: 420px;
  }
  .logo-auth {
    margin-bottom: 14px;
    padding-bottom: 6px;
    animation: logoFloat 7s ease-in-out infinite;
  }
  .logo-auth .logo-text {
    font-size: clamp(1.95rem, 9.5vw, 2.55rem);
    letter-spacing: 0.06em;
  }
  .logo-auth .logo-underline {
    width: min(62%, 140px);
    margin-top: 8px;
  }
  .card {
    width: 100%;
    max-width: none;
    padding: 20px 16px 18px;
    border-radius: 14px;
  }
  .card h1 {
    font-size: 1.28rem;
  }
  .card .sub {
    font-size: 0.88rem;
    margin-bottom: 16px;
  }
  .field {
    margin-bottom: 12px;
  }
  .field input {
    min-height: 48px;
    padding: 13px 14px;
    font-size: 16px; /* prevent iOS zoom */
    border-radius: 12px;
  }
  .btn {
    min-height: 48px;
    padding: 13px 14px;
    font-size: 1rem;
    border-radius: 12px;
  }
  .cap {
    padding: 12px 12px 10px;
    margin: 4px 0 14px;
  }
  .cap-box {
    min-height: 48px;
    padding: 8px 4px;
    gap: 14px;
    -webkit-tap-highlight-color: transparent;
  }
  .cap-check {
    width: 26px;
    height: 26px;
  }
  .cap[data-state="ok"] .cap-check::after {
    left: 8px;
    top: 3px;
  }
  .cap-label {
    font-size: 1rem;
  }
  .foot {
    margin-top: 14px;
    font-size: 0.92rem;
    line-height: 1.4;
  }
  .foot a {
    display: inline-block;
    padding: 4px 2px;
  }
  .topbar {
    padding: 12px 14px;
    gap: 10px;
  }
  .topbar .user {
    font-size: 0.8rem;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .logo-auth .logo-text {
    font-size: clamp(1.75rem, 10vw, 2.2rem);
  }
  .card {
    padding: 18px 14px 16px;
  }
}

/* ——— Vendor onboarding ——— */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.dash-main-onboard {
  align-items: start;
  padding-top: 28px;
}
.onboard-card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}
.onboard-kicker {
  margin: 0 0 6px;
  color: var(--crimson-soft);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.onboard-card h1 {
  margin: 0 0 8px;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}
.onboard-actions {
  margin: 0 0 10px;
}
.onboard-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
.onboard-vendor .field-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}
#word-count.ok { color: var(--crimson-soft); }
#word-count.bad { color: #fecaca; }
.field-help {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.muted { color: var(--muted); }
textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 13px;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.45;
  resize: vertical;
  min-height: 140px;
  outline: none;
}
textarea:focus {
  border-color: rgba(225, 29, 72, 0.7);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.18);
}
.input-prefix {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  border-radius: 10px;
  overflow: hidden;
}
.input-prefix > span {
  padding: 0 4px 0 12px;
  color: var(--muted);
  font-weight: 600;
}
.input-prefix input {
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  min-width: 0;
}
.input-prefix:focus-within {
  border-color: rgba(225, 29, 72, 0.7);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.18);
}
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .dash-main-onboard {
    padding: 18px 14px 28px;
    width: 100%;
  }
  .onboard-card {
    max-width: none;
    padding: 20px 16px 18px;
  }
  .onboard-card h1 { font-size: 1.28rem; }
  .onboard-actions .btn {
    min-height: 48px;
  }
  textarea {
    min-height: 160px;
  }
}

/* ——— Nav + Deposit ——— */
.topnav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.topnav-link {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 10px;
  border-radius: 8px;
}
.topnav-link:hover, .topnav-link.is-active {
  color: #fff;
  background: rgba(225, 29, 72, 0.15);
}
.bal-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(225, 29, 72, 0.35);
  color: var(--crimson-soft);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
}
.nav-fab {
  display: none;
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 40;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: #fff;
  font-size: 1.2rem;
  box-shadow: var(--shadow);
}
.nav-drawer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  display: grid;
  align-items: end;
}
.nav-drawer-inner {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 18px 16px max(22px, env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
  border-radius: 16px 16px 0 0;
}
.nav-drawer-inner a {
  display: block;
  padding: 14px 12px;
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text);
  font-weight: 600;
}
.dep-card h2 { font-size: 1.05rem; margin: 0 0 8px; }
.dep-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.coin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.coin-btn {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.coin-btn:hover { border-color: rgba(225,29,72,0.6); }
.dep-addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
  word-break: break-all;
  padding: 12px;
  border-radius: 10px;
  background: #0a0a0c;
  border: 1px solid var(--border-strong);
  margin: 8px 0 12px;
}
.dep-label { color: var(--muted); font-size: 0.85rem; margin: 0; }
.dep-list { list-style: none; padding: 0; margin: 0; }
.dep-list li {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}
@media (max-width: 720px) {
  .topnav { display: none; }
  .nav-fab { display: inline-flex; align-items: center; justify-content: center; }
  .topbar .user { display: none; }
}
@media (min-width: 721px) {
  .nav-drawer, .nav-fab { display: none !important; }
}

/* Site alert under navbar — ultra-thin single line */
.nav-alert {
  width: 100%;
  background: #e11d48 !important;
  color: #fff !important;
  text-align: center;
  padding: 2px 10px !important;
  border: 0 !important;
  box-shadow: none !important;
  line-height: 1.15 !important;
  min-height: 0 !important;
  max-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-alert p {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.01em;
  line-height: 1.15 !important;
  color: #fff !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
@media (max-width: 640px) {
  .nav-alert {
    padding: 1px 8px !important;
    max-height: 20px;
  }
  .nav-alert p {
    font-size: 10px !important;
  }
}

/* Unread message badge + toast */
.topnav-messages,
.drawer-messages {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.msg-badge {
  display: none;
  position: absolute;
  top: -6px;
  left: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px #050506;
  z-index: 2;
}
.msg-badge.is-on { display: inline-block; }
.drawer-messages {
  position: relative;
}
.drawer-messages .msg-badge {
  top: 8px;
  left: 8px;
}
.msg-toast {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(72px, env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(320px, calc(100vw - 24px));
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(225, 29, 72, 0.55);
  background: #111114;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}
.msg-toast.is-on {
  opacity: 1;
  transform: translateY(0);
}
@media (min-width: 721px) {
  .msg-toast { bottom: max(16px, env(safe-area-inset-bottom)); }
}
