/* LIFT CLUB — design system.
   Brand: LIFT DARK MIDNIGHT ground, LIFT BEIGE type, LIFT BROWN pulled into a
   metallic gradient for the gold-card accents. Wide tracking, hairline rules,
   nothing shouts. Mobile-first: this lives in a hand, in a dark room. */

:root {
  --midnight: #111524;
  --midnight-deep: #0B0E19;
  --midnight-soft: #191E30;
  --green: #374037;
  --beige: #D4CCC6;
  --light: #F2F2F1;
  --brown: #8B6C47;

  --gold-1: #8B6C47;
  --gold-2: #E3C795;
  --gold-3: #B8925A;
  --gold: linear-gradient(135deg, var(--gold-1) 0%, var(--gold-2) 48%, var(--gold-3) 100%);

  --ink: var(--beige);
  --ink-dim: rgba(212, 204, 198, 0.58);
  --ink-faint: rgba(212, 204, 198, 0.32);
  --line: rgba(212, 204, 198, 0.13);
  --line-soft: rgba(212, 204, 198, 0.07);
  --surface: rgba(212, 204, 198, 0.035);
  --surface-2: rgba(212, 204, 198, 0.06);

  --ok: #7FB08A;
  --warn: #D8A657;
  --err: #C97A6D;

  --r: 14px;
  --pad: 20px;
  --maxw: 520px;

  --display: 'Jost', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Jost', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--midnight-deep);
  background-image:
    radial-gradient(120% 70% at 50% -10%, rgba(139, 108, 71, 0.20) 0%, rgba(139, 108, 71, 0) 62%),
    linear-gradient(180deg, var(--midnight) 0%, var(--midnight-deep) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--body);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad) 120px; }
.wrap-wide { max-width: 1080px; }

/* ── wordmark ───────────────────────────────────────────────────────────── */
.mark {
  font-family: var(--display);
  font-weight: 200;
  letter-spacing: 0.44em;
  text-indent: 0.44em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--beige);
}
.mark-lg { font-size: 34px; }
.mark-md { font-size: 22px; }
.mark-sm { font-size: 15px; }
.mark-sub {
  font-size: 9px;
  letter-spacing: 0.52em;
  text-indent: 0.52em;
  color: var(--ink-faint);
  margin-top: 8px;
  text-transform: uppercase;
}

/* ── type scale ─────────────────────────────────────────────────────────── */
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
}
.h1 { font-family: var(--display); font-weight: 200; font-size: 26px; letter-spacing: 0.16em; text-transform: uppercase; margin: 0; }
.h2 { font-family: var(--display); font-weight: 300; font-size: 17px; letter-spacing: 0.2em; text-transform: uppercase; margin: 0; }
.h3 { font-family: var(--display); font-weight: 400; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; margin: 0; }
.body { color: var(--ink-dim); font-size: 14px; }
.small { font-size: 12px; color: var(--ink-dim); }
.tiny { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.06em; }
/* Gradient tightened vs --gold: over a long headline the wide 135deg ramp
   runs past the pale mid-stop and the last words read as plain white. */
.gold-text {
  background: linear-gradient(100deg, #C9A055 0%, #E3C795 42%, #C9A055 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.num { font-variant-numeric: tabular-nums; }

/* ── rules ──────────────────────────────────────────────────────────────── */
.rule { height: 1px; background: var(--line); border: 0; margin: 28px 0; }
.rule-gold { height: 1px; border: 0; margin: 28px 0; background: linear-gradient(90deg, transparent, rgba(227,199,149,0.42), transparent); }

/* ── surfaces ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
}
.card + .card { margin-top: 12px; }
.card-flush { padding: 0; overflow: hidden; }

/* ── buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; padding: 0 20px;
  border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--ink);
  font-family: var(--display); font-size: 12px; font-weight: 400;
  letter-spacing: 0.22em; text-transform: uppercase; text-indent: 0.22em;
  cursor: pointer; transition: background .18s ease, border-color .18s ease, opacity .18s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:hover { background: var(--surface-2); border-color: rgba(212,204,198,0.24); }
.btn-gold {
  background: var(--gold); border: 0; color: #221A0E; font-weight: 500;
  box-shadow: 0 6px 24px rgba(184, 146, 90, 0.18);
}
.btn-gold:hover { background: var(--gold); filter: brightness(1.06); }
.btn-ghost { min-height: 44px; font-size: 11px; }
.btn[disabled] { opacity: .38; pointer-events: none; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── forms ──────────────────────────────────────────────────────────────── */
label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block; margin-bottom: 7px;
  font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-faint);
}
input, select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  background: rgba(0,0,0,0.22); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--body); font-size: 16px; font-weight: 300; /* 16px stops iOS zoom */
  letter-spacing: 0.04em;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: rgba(227,199,149,0.45);
  box-shadow: 0 0 0 3px rgba(227,199,149,0.08);
}
input::placeholder { color: rgba(212,204,198,0.25); }
input.pin { text-align: center; font-size: 26px; letter-spacing: 0.5em; text-indent: 0.5em; font-weight: 200; }

/* ── progress ───────────────────────────────────────────────────────────── */
.bar { height: 3px; background: rgba(212,204,198,0.12); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--gold); border-radius: 3px; transition: width .7s cubic-bezier(.2,.7,.2,1); }

/* ── privilege rows ─────────────────────────────────────────────────────── */
.rung {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center;
  padding: 15px 0; border-bottom: 1px solid var(--line-soft);
}
.rung:last-child { border-bottom: 0; }
.rung-ico {
  width: 52px; height: 52px; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center;
}
.rung-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rung-ico svg { width: 26px; height: 26px; stroke: #C9A96A; }
.rung.is-locked .rung-ico svg { stroke: rgba(212,204,198,0.55); }
.rung-name { font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.rung-meta { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.05em; margin-top: 2px; }
.rung.is-locked { opacity: .42; }
.rung.is-claimed .rung-name { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: rgba(212,204,198,0.3); }

.pill {
  font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line); color: var(--ink-faint);
}
.pill-gold { background: var(--gold); border: 0; color: #221A0E; font-weight: 500; }
.pill-ok { border-color: rgba(127,176,138,0.4); color: var(--ok); }

/* ── QR ─────────────────────────────────────────────────────────────────── */
.qr-plate {
  background: var(--light); border-radius: 12px; padding: 16px;
  display: grid; place-items: center; margin: 0 auto;
}
.qr-plate canvas, .qr-plate img { display: block; width: 100%; height: auto; image-rendering: pixelated; }

/* ── member card ────────────────────────────────────────────────────────── */
.goldcard {
  position: relative; border-radius: 16px; overflow: hidden; padding: 22px;
  background: var(--gold);
  color: #221A0E;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.35);
}
.goldcard::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,0.42) 0%, rgba(255,255,255,0) 32%, rgba(255,255,255,0) 62%, rgba(255,255,255,0.22) 100%);
  mix-blend-mode: soft-light;
}
.goldcard .mark { color: #221A0E; }
.goldcard .mark-sub { color: rgba(34,26,14,0.62); }

/* ── nav ────────────────────────────────────────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(11,14,25,0.94);
  backdrop-filter: blur(18px) saturate(140%);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  padding: 14px 6px 15px; text-align: center; text-decoration: none;
  color: var(--ink-faint); font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  display: grid; gap: 6px; justify-items: center;
}
.tabbar a.on { color: var(--beige); }
.tabbar svg { width: 19px; height: 19px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px var(--pad); margin: 0 calc(var(--pad) * -1) 8px;
  background: linear-gradient(180deg, rgba(11,14,25,0.96) 60%, rgba(11,14,25,0));
  backdrop-filter: blur(10px);
}

/* ── layout helpers ─────────────────────────────────────────────────────── */
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mt-s { margin-top: 8px; } .mt-m { margin-top: 18px; } .mt-l { margin-top: 32px; }
.hidden { display: none !important; }

.stat { text-align: center; padding: 16px 10px; }
.stat .v { font-family: var(--display); font-weight: 200; font-size: 30px; line-height: 1; letter-spacing: 0.02em; }
.stat .k { font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-faint); margin-top: 8px; }

/* ── toast + sheet ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 14px);
  z-index: 90; max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 999px;
  background: rgba(25,30,48,0.97); border: 1px solid var(--line);
  font-size: 12px; letter-spacing: 0.08em; color: var(--ink);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(201,122,109,0.5); color: #E8B5AC; }

.sheet-bg {
  position: fixed; inset: 0; z-index: 80; background: rgba(6,8,14,0.82);
  backdrop-filter: blur(8px);
  display: grid; place-items: end center;
  opacity: 0; pointer-events: none; transition: opacity .28s ease;
}
.sheet-bg.on { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: var(--maxw);
  background: var(--midnight); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 20px 20px 0 0; padding: 26px 22px calc(30px + env(safe-area-inset-bottom));
  transform: translateY(16px); transition: transform .28s cubic-bezier(.2,.8,.2,1);
  max-height: 92dvh; overflow-y: auto;
}
.sheet-bg.on .sheet { transform: translateY(0); }
.sheet-grab { width: 36px; height: 3px; border-radius: 3px; background: var(--line); margin: -8px auto 18px; }

/* ── animation ──────────────────────────────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
.rise-2 { animation-delay: .07s; } .rise-3 { animation-delay: .14s; } .rise-4 { animation-delay: .21s; }
@keyframes pulse-gold { 0%,100% { box-shadow: 0 0 0 0 rgba(227,199,149,0.30); } 50% { box-shadow: 0 0 0 12px rgba(227,199,149,0); } }
.pulse { animation: pulse-gold 2.4s ease-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(212,204,198,0.2); border-top-color: var(--beige);
  animation: spin .8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ── scanner ────────────────────────────────────────────────────────────── */
.scanner { position: relative; border-radius: var(--r); overflow: hidden; background: #000; aspect-ratio: 3/4; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.scanner-frame .box {
  width: 66%; aspect-ratio: 1; border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(6,8,14,0.55);
  border: 1px solid rgba(227,199,149,0.55);
}
.scanner-hint {
  position: absolute; left: 0; right: 0; bottom: 14px; text-align: center;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(242,242,241,0.82);
  text-shadow: 0 1px 8px rgba(0,0,0,.8);
}

/* ── tables (admin) ─────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 400; font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-faint); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-scroll { overflow-x: auto; }

@media (min-width: 760px) {
  :root { --pad: 28px; }
  .wrap-wide .grid-3 { gap: 16px; }
}
