/* ============================================================
   STARIUM SPACEFARERS — Futuristic Sci-Fi Theme (Mobile-First)
   Palette: Deep Navy #0B1426 | Esports Gold #D4A373 | Light Cyan #00E5FF
   Font: Nunito
   ============================================================ */

:root {
  --navy: #0B1426;
  --navy-2: #0F1B33;
  --navy-3: #132244;
  --slate: #0D1830;
  --panel: rgba(19, 34, 68, 0.72);
  --panel-solid: #132244;
  --gold: #D4A373;
  --gold-2: #E9C08A;
  --gold-glow: rgba(212, 163, 115, 0.35);
  --cyan: #00E5FF;
  --cyan-2: #7DF3FF;
  --cyan-glow: rgba(0, 229, 255, 0.35);
  --text: #E6EDF7;
  --muted: #8FA1BF;
  --line: rgba(143, 161, 191, 0.18);
  --danger: #FF5678;
  --success: #4ADE80;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 24px var(--cyan-glow);

  --touch: 46px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --nav-h: 60px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, Segoe UI, sans-serif;
  font-weight: 400;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(0, 229, 255, 0.10), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(212, 163, 115, 0.10), transparent 60%),
    var(--navy);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
body.modal-open { overflow: hidden; touch-action: none; }
body.admin-open { overflow: hidden; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: 'Nunito', sans-serif; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.hidden { display: none !important; }
.muted { opacity: 0.55; }
.mt { margin-top: 24px; }
.gold { color: var(--gold); }
.gold-strong { color: var(--gold); font-weight: 800; }
.grad-text {
  background: linear-gradient(90deg, var(--gold), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
* { -webkit-overflow-scrolling: touch; }
textarea.input { resize: vertical; min-height: 90px; font-family: inherit; }

/* ---------- Layout ---------- */
.container { width: min(1220px, 92%); margin-inline: auto; padding-left: max(0px, var(--safe-left)); padding-right: max(0px, var(--safe-right)); }
.section { padding: 72px 0; position: relative; }
.section.alt { background: linear-gradient(180deg, rgba(15,27,51,0.55), rgba(11,20,38,0.2)); }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 32px;
}
.section-title { font-size: clamp(1.75rem, 5vw, 2.6rem); margin: 6px 0 4px; }
.section-sub { color: var(--muted); max-width: 620px; margin: 0; font-size: 0.95rem; }
.eyebrow {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.26em;
  color: var(--cyan); text-transform: uppercase;
}
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 22px;
  min-height: var(--touch);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.btn-lg { padding: 15px 30px; font-size: 1rem; min-height: 52px; }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; min-height: 38px; }
.btn-block { width: 100%; }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #C58A5B);
  color: #14203C;
  box-shadow: 0 8px 24px rgba(212, 163, 115, 0.35);
}
.btn-gold:hover { box-shadow: 0 10px 32px rgba(212, 163, 115, 0.55); }

.btn-cyan {
  background: linear-gradient(135deg, var(--cyan), #0099CC);
  color: #06121F;
  box-shadow: 0 8px 24px var(--cyan-glow);
}
.btn-cyan:hover { box-shadow: 0 10px 32px rgba(0, 229, 255, 0.55); }

.btn-outline {
  background: transparent;
  border-color: rgba(212, 163, 115, 0.5);
  color: var(--gold);
}
.btn-outline:hover { background: rgba(212, 163, 115, 0.12); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

.btn-danger {
  background: linear-gradient(135deg, #FF5678, #C73155);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 86, 120, 0.35);
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(circle at center, #0F1B33, #060B18 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  padding: 20px;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loading-overlay.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-core { position: relative; width: 130px; height: 130px; display: grid; place-items: center; }
.loader-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--cyan);
  border-right-color: rgba(0, 229, 255, 0.25);
  animation: spin 1.4s linear infinite;
}
.loader-ring.ring-2 {
  inset: 14px;
  border-top-color: var(--gold);
  border-right-color: rgba(212, 163, 115, 0.25);
  animation: spin 2s linear infinite reverse;
}
.loader-ring.ring-3 {
  inset: 28px;
  border-top-color: var(--cyan-2);
  animation: spin 0.9s linear infinite;
}
.loader-logo {
  font-size: 2.2rem; color: var(--gold);
  text-shadow: 0 0 24px var(--gold-glow);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.15); opacity: 0.75; } }

.loader-title {
  font-size: clamp(1.3rem, 5vw, 1.9rem); letter-spacing: 0.18em; color: var(--text);
  text-shadow: 0 0 30px var(--cyan-glow); margin: 0; text-align: center;
}
.loader-title span { color: var(--gold); }
.loader-sub { color: var(--muted); font-size: 0.88rem; margin: 0; text-align: center; }
.progress-track {
  width: min(420px, 78vw); height: 8px; border-radius: 999px;
  background: rgba(143, 161, 191, 0.15); overflow: hidden; margin-top: 6px;
}
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  box-shadow: 0 0 18px var(--cyan-glow);
  transition: width 0.25s ease;
}
.progress-value { color: var(--cyan); font-weight: 800; letter-spacing: 0.15em; font-size: 0.85rem; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 500;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(11, 20, 38, 0.86);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-top);
}
.nav-inner {
  width: min(1220px, 92%); margin-inline: auto;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--nav-h);
  height: var(--nav-h);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  font-size: 1.5rem; color: var(--gold);
  text-shadow: 0 0 16px var(--gold-glow);
}
.brand-text {
  font-weight: 900; letter-spacing: 0.08em; font-size: 0.95rem; display: flex; flex-direction: column;
  line-height: 1;
}
.brand-text em {
  font-style: normal; font-size: 0.6rem; color: var(--cyan);
  letter-spacing: 0.34em; font-weight: 700;
}
.nav-links { display: flex; gap: 2px; margin-left: auto; }
.nav-link {
  padding: 10px 14px; border-radius: 999px; font-weight: 700; font-size: 0.88rem;
  color: var(--muted); transition: color 0.2s, background 0.2s;
  min-height: 40px; display: inline-flex; align-items: center;
}
.nav-link:hover { color: var(--text); background: rgba(0, 229, 255, 0.08); }
.nav-link.active { color: var(--gold); background: rgba(212, 163, 115, 0.1); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-toggle {
  display: none; background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  color: var(--text); font-size: 1.35rem; cursor: pointer;
  width: var(--touch); height: var(--touch); border-radius: 12px;
  align-items: center; justify-content: center;
  transition: background 0.15s;
}
.nav-toggle:active { background: rgba(255,255,255,0.12); }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 4px 4px; border-radius: 999px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.25);
}
.user-chip img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--cyan); }
.chip-meta { display: flex; flex-direction: column; line-height: 1.05; font-size: 0.75rem; }
.chip-meta strong { color: var(--text); font-size: 0.82rem; }
.chip-meta span { color: var(--gold); font-weight: 800; }

/* ---------- Hero ---------- */
.hero { padding: 70px 0 50px; position: relative; overflow: hidden; }
.hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(0, 229, 255, 0.12) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 70% 40%, #000 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 70% 40%, #000 20%, transparent 70%);
  pointer-events: none;
}
.hero-inner { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center; }
.hero-title { font-size: clamp(2rem, 6vw, 4rem); line-height: 1.05; margin: 12px 0 18px; }
.hero-sub { color: var(--muted); font-size: 1rem; max-width: 560px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0 30px; }
.hero-cta .btn { flex: 1 1 auto; min-width: 160px; }
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-pill {
  padding: 14px 10px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  text-align: center; backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.stat-pill strong { display: block; font-size: 1.25rem; color: var(--cyan); font-weight: 900; line-height: 1.15; }
.stat-pill span { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

/* Orbit visual */
.hero-visual { display: grid; place-items: center; }
.orbit-stage {
  position: relative; width: 320px; height: 320px; display: grid; place-items: center;
}
.orbit-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px dashed rgba(0, 229, 255, 0.35);
  animation: spin 26s linear infinite;
}
.orbit-ring.r2 { inset: 40px; border-color: rgba(212, 163, 115, 0.35); animation-duration: 18s; animation-direction: reverse; }
.orbit-ring.r3 { inset: 80px; border-color: rgba(0, 229, 255, 0.25); animation-duration: 12s; }
.orbit-planet {
  font-size: 3.4rem; color: var(--gold);
  text-shadow: 0 0 40px var(--gold-glow), 0 0 80px rgba(212, 163, 115, 0.3);
  animation: pulse 3s ease-in-out infinite;
}
.orbit-node {
  position: absolute; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 229, 255, 0.12); border: 1px solid var(--cyan);
  color: var(--cyan); font-size: 1.1rem;
  box-shadow: 0 0 20px var(--cyan-glow);
}
.orbit-node.n1 { top: 0; left: 50%; transform: translateX(-50%); }
.orbit-node.n2 { bottom: 30px; right: 20px; }
.orbit-node.n3 { bottom: 30px; left: 20px; }

/* ---------- Panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.panel:hover { border-color: rgba(0, 229, 255, 0.35); }

.empty-state {
  grid-column: 1 / -1; text-align: center; color: var(--muted);
  padding: 40px 20px; border: 1px dashed var(--line); border-radius: var(--radius-lg);
}

/* ---------- Leaderboard Cards ---------- */
.rank-card {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, rgba(19,34,68,0.9), rgba(11,20,38,0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.rank-card:hover { transform: translateY(-4px); border-color: rgba(212, 163, 115, 0.5); }
.rank-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--cyan));
}
.rank-card.tier-gold::before { background: linear-gradient(90deg, #FFD700, #D4A373); }
.rank-card.tier-cyan::before { background: linear-gradient(90deg, var(--cyan), var(--cyan-2)); }
.rank-card.tier-vip::before { background: linear-gradient(90deg, #FFD700, var(--cyan), #D4A373); }
.rank-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.rank-card-head img {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--gold); box-shadow: 0 0 18px var(--gold-glow);
  flex-shrink: 0;
}
.rank-card-name { font-weight: 800; font-size: 1rem; }
.rank-card-sub { color: var(--muted); font-size: 0.78rem; }
.rank-position {
  position: absolute; top: 14px; right: 16px;
  font-size: 1.35rem; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 20px var(--gold-glow);
}

/* ---------- BADGE SYSTEM (rank / role / exclusive) ---------- */
.rank-role-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center; }
.badge-rank {
  font-size: 0.68rem; padding: 3px 10px; border-radius: 999px;
  background: rgba(212, 163, 115, 0.14); color: var(--gold);
  border: 1px solid rgba(212, 163, 115, 0.45); font-weight: 800;
  letter-spacing: 0.04em;
}
.badge-role {
  font-size: 0.68rem; padding: 3px 10px; border-radius: 999px;
  background: rgba(0, 229, 255, 0.1); color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.3); font-weight: 700;
}
.badge-exclusive {
  font-size: 0.66rem; padding: 3px 10px; border-radius: 999px;
  font-weight: 900; letter-spacing: 0.14em;
  background: linear-gradient(135deg, var(--gold), var(--cyan));
  color: #06121F; border: none;
}
.badge-exclusive.vip {
  background: linear-gradient(135deg, #FFD700, var(--cyan), #D4A373);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.45);
}
.badge-exclusive.gold { background: linear-gradient(135deg, #FFD700, #D4A373); }
.badge-img {
  width: 24px; height: 24px; object-fit: contain; border-radius: 6px;
  background: rgba(0,0,0,0.25); padding: 2px;
  border: 1px solid var(--line);
}

.rank-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.rank-stats div {
  background: rgba(0, 0, 0, 0.25); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 0.8rem;
}
.rank-stats span { display: block; color: var(--muted); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.rank-stats strong { color: var(--cyan); font-size: 0.95rem; }
.rank-badge-tier {
  position: absolute; bottom: 12px; right: 14px;
  font-size: 0.65rem; font-weight: 900; letter-spacing: 0.16em;
  padding: 4px 10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--cyan));
  color: #06121F;
}

/* ---------- Missions ---------- */
.mission-card { text-align: left; position: relative; }
.mission-icon {
  width: 54px; height: 54px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.5rem;
  background: rgba(0, 229, 255, 0.1); border: 1px solid rgba(0, 229, 255, 0.35);
  color: var(--cyan); margin-bottom: 14px;
}
.mission-reward {
  display: inline-block; font-weight: 800; color: var(--gold);
  font-size: 0.85rem; margin: 8px 0 16px;
  padding: 4px 12px; border-radius: 999px;
  background: rgba(212, 163, 115, 0.12);
  border: 1px solid rgba(212, 163, 115, 0.3);
}

.energy-panel { margin-top: 26px; }
.energy-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.energy-head h3 { margin: 0; font-size: 1.1rem; }
.energy-head span { color: var(--cyan); font-weight: 800; font-size: 0.88rem; }
.energy-bar {
  height: 12px; border-radius: 999px; overflow: hidden;
  background: rgba(143, 161, 191, 0.15);
}
.energy-bar span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  box-shadow: 0 0 20px var(--cyan-glow);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hint { color: var(--muted); font-size: 0.8rem; margin: 10px 0 0; }
.hint code {
  background: rgba(0, 229, 255, 0.08); color: var(--cyan);
  padding: 2px 8px; border-radius: 6px; font-size: 0.78rem;
  word-break: break-word;
}
.hint.warn { color: #FFB37A; }

/* ---------- Scrim Cards ---------- */
.scrim-card {
  position: relative;
  background: linear-gradient(160deg, rgba(19,34,68,0.9), rgba(11,20,38,0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
}
.scrim-info { flex: 1; min-width: 180px; }
.scrim-info h3 { font-size: 1.1rem; margin-bottom: 6px; }
.scrim-info p { color: var(--muted); font-size: 0.85rem; margin: 4px 0; }
.scrim-reward {
  display: inline-block; font-weight: 800; color: var(--gold);
  font-size: 0.85rem; margin-top: 8px;
  padding: 4px 12px; border-radius: 999px;
  background: rgba(212, 163, 115, 0.12);
  border: 1px solid rgba(212, 163, 115, 0.3);
}
.scrim-qr {
  background: #fff; padding: 8px; border-radius: 14px;
  box-shadow: 0 0 24px var(--cyan-glow);
  width: 126px; height: 126px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.scrim-qr img { width: 110px; height: 110px; object-fit: contain; }
.scrim-qr-wait {
  text-align: center; color: #4A5875; font-size: 0.68rem; line-height: 1.3;
  padding: 8px;
}
.scrim-qr-wait span { font-size: 1.4rem; display: block; margin-bottom: 4px; }
.scrim-qr-wait p { margin: 0; color: #4A5875; }

/* ---------- Updates ---------- */
.update-card { position: relative; }
.update-card .tag {
  display: inline-block; font-size: 0.68rem; font-weight: 900;
  letter-spacing: 0.18em; padding: 4px 10px; border-radius: 999px;
  background: rgba(0, 229, 255, 0.12); color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.35); margin-bottom: 12px;
}
.update-card h3 { font-size: 1.05rem; }
.update-card p { color: var(--muted); font-size: 0.88rem; }
.update-card time { font-size: 0.75rem; color: var(--muted); }

/* ---------- Chat / COMMS ARRAY ---------- */
.online-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 700; color: var(--cyan);
  padding: 6px 14px; border-radius: 999px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
}
.online-pill i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 10px var(--success); animation: pulse 1.6s infinite;
}
.chat-shell { position: relative; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat-window {
  height: 460px; overflow-y: auto; padding: 20px;
  background: rgba(6, 11, 24, 0.4);
  overscroll-behavior: contain;
}
.chat-window::-webkit-scrollbar { width: 6px; }
.chat-window::-webkit-scrollbar-thumb { background: var(--cyan-glow); border-radius: 999px; }
.chat-messages { display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.chat-messages .empty-state { border: none; padding: 30px 10px; }

.chat-locked {
  position: absolute; inset: 0; z-index: 4;
  background: rgba(6, 11, 24, 0.94);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; color: var(--muted);
  padding: 24px;
}
.chat-locked h3 { color: var(--text); margin: 0; }
.chat-locked p { margin: 0 0 8px; font-size: 0.9rem; }
.lock-icon { font-size: 2.5rem; }

.msg { display: flex; gap: 10px; max-width: 78%; }
.msg.own { margin-left: auto; flex-direction: row-reverse; }
.msg-avatar {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--cyan); flex-shrink: 0;
}
.msg.own .msg-avatar { border-color: var(--gold); }
.msg-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.msg.own .msg-body { align-items: flex-end; }
.msg-meta { display: flex; gap: 8px; align-items: center; font-size: 0.7rem; color: var(--muted); flex-wrap: wrap; }
.msg-meta strong { color: var(--cyan); font-weight: 800; }
.msg.own .msg-meta strong { color: var(--gold); }
.msg-rank {
  font-size: 0.62rem; padding: 1px 8px; border-radius: 999px;
  background: rgba(212, 163, 115, 0.15); color: var(--gold);
  border: 1px solid rgba(212, 163, 115, 0.35); font-weight: 800;
  letter-spacing: 0.06em;
}
.msg-bubble {
  padding: 10px 14px; border-radius: 16px;
  background: rgba(19, 34, 68, 0.95);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.msg.own .msg-bubble {
  background: linear-gradient(135deg, rgba(212, 163, 115, 0.2), rgba(0, 229, 255, 0.12));
  border-color: rgba(212, 163, 115, 0.4);
}
.chat-input {
  display: flex; gap: 10px; padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(11, 20, 38, 0.85);
  padding-bottom: calc(14px + var(--safe-bottom));
}
.chat-input input {
  flex: 1; padding: 12px 18px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line);
  color: var(--text); font-family: inherit; font-size: 16px;
  outline: none; transition: border-color 0.2s;
  min-width: 0;
}
.chat-input input:focus { border-color: var(--cyan); }
.chat-input input:disabled { opacity: 0.4; }

/* ---------- Membership Tiers ---------- */
.tier-card {
  position: relative; display: flex; flex-direction: column;
  padding: 26px 22px;
}
.tier-card.featured { border-color: rgba(212, 163, 115, 0.55); box-shadow: 0 0 32px rgba(212, 163, 115, 0.2); }
.tier-card.vip { border-color: rgba(0, 229, 255, 0.55); box-shadow: 0 0 32px var(--cyan-glow); }
.tier-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.tier-price { margin: 12px 0 20px; display: flex; flex-direction: column; gap: 2px; }
.tier-price .amount { font-size: 2rem; font-weight: 900; color: var(--gold); line-height: 1; }
.tier-price .period { font-size: 0.82rem; color: var(--muted); }
.tier-price s { color: var(--muted); margin-right: 6px; }
.tier-list { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 10px; font-size: 0.88rem; }
.tier-list li { color: var(--text); }
.ribbon {
  position: absolute; top: -10px; right: 18px;
  background: linear-gradient(135deg, var(--gold), #C58A5B);
  color: #14203C; font-weight: 900; font-size: 0.7rem;
  padding: 4px 12px; border-radius: 999px;
  letter-spacing: 0.1em;
  box-shadow: 0 6px 18px var(--gold-glow);
}
.ribbon.cyan { background: linear-gradient(135deg, var(--cyan), #0099CC); color: #06121F; box-shadow: 0 6px 18px var(--cyan-glow); }

/* ---------- Coin Converter ---------- */
.converter {
  margin-top: 28px;
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 30px; align-items: center;
}
.converter-copy h3 { font-size: 1.2rem; margin-bottom: 6px; }
.converter-copy p { color: var(--muted); font-size: 0.9rem; margin: 0; }
.converter-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.converter-form .field { flex: 1; min-width: 140px; margin: 0; }
.converter-equals { font-size: 1.4rem; color: var(--cyan); font-weight: 900; padding-bottom: 14px; }
.converter-result {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: rgba(0, 229, 255, 0.08); border: 1px solid rgba(0, 229, 255, 0.3);
  min-width: 130px;
}
.converter-result strong { color: var(--gold); font-size: 1.2rem; font-weight: 900; }
.converter-result .label { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field .label {
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.input {
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--line);
  color: var(--text); font-family: inherit; font-size: 16px;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%; min-height: var(--touch);
}
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-glow); }
.input::placeholder { color: rgba(143, 161, 191, 0.55); }
select.input {
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--cyan) 50%), linear-gradient(135deg, var(--cyan) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
  padding-right: 36px;
}
.checkbox-field { flex-direction: row; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--muted); }
.checkbox-field input { accent-color: var(--cyan); width: 20px; height: 20px; flex-shrink: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.link-btn {
  background: none; border: none; color: var(--cyan); font-size: 0.82rem;
  font-weight: 700; padding: 6px 0; cursor: pointer; margin-bottom: 14px;
  align-self: flex-start; text-align: left;
}
.link-btn:hover { text-decoration: underline; }

/* Role chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 16px; border-radius: 999px; font-size: 0.82rem; font-weight: 700;
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line);
  color: var(--muted); cursor: pointer; transition: all 0.15s;
  min-height: 40px; display: inline-flex; align-items: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.chip:hover { border-color: var(--cyan); color: var(--text); }
.chip.active {
  background: rgba(0, 229, 255, 0.15); border-color: var(--cyan);
  color: var(--cyan); box-shadow: 0 0 12px var(--cyan-glow);
}

/* Avatar upload */
.avatar-upload { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar-upload img {
  width: 70px; height: 70px; border-radius: 50%; object-fit: cover;
  border: 2px dashed var(--cyan); background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* Passkey visual */
.passkey-visual {
  position: relative;
  width: 120px; height: 120px;
  margin: 8px auto 24px;
  display: grid; place-items: center;
  font-size: 2.4rem;
}
.passkey-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px dashed rgba(0, 229, 255, 0.45);
  animation: spin 14s linear infinite;
}
.passkey-visual::after {
  content: '';
  position: absolute; inset: 14px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,229,255,0.18), transparent 70%);
}

/* Segmented filter */
.segmented {
  display: inline-flex; gap: 2px; padding: 4px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line);
  border-radius: 999px; flex-wrap: nowrap;
  max-width: 100%; overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.segmented::-webkit-scrollbar { display: none; }
.seg {
  background: transparent; border: none; color: var(--muted);
  padding: 9px 16px; border-radius: 999px; font-size: 0.82rem;
  font-weight: 700; cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
  min-height: 40px;
  touch-action: manipulation;
}
.seg:hover { color: var(--text); }
.seg.active { background: linear-gradient(135deg, var(--cyan), #0099CC); color: #06121F; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 60px; padding: 40px 0 30px;
  padding-bottom: calc(30px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(6, 11, 24, 0.7));
}
.footer-inner {
  display: grid; grid-template-columns: 1.2fr 1fr 1.2fr; gap: 30px; align-items: center;
}
.footer-brand { display: flex; gap: 12px; align-items: center; }
.footer-brand strong { letter-spacing: 0.14em; font-size: 0.85rem; }
.footer-brand p { margin: 2px 0 0; color: var(--muted); font-size: 0.78rem; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.85rem; }
.footer-links a { color: var(--muted); transition: color 0.2s; padding: 6px 0; }
.footer-links a:hover { color: var(--cyan); }
.footer-legal { text-align: right; }
.copyright { font-size: 0.85rem; color: var(--muted); margin: 0 0 8px; }
.messenger-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.82rem; font-weight: 700;
  padding: 10px 18px; border-radius: 999px;
  background: rgba(0, 229, 255, 0.1); color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.35);
  transition: all 0.2s;
  min-height: var(--touch);
}
.messenger-link:hover { background: rgba(0, 229, 255, 0.2); box-shadow: 0 0 18px var(--cyan-glow); }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(6, 11, 24, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-backdrop.show { opacity: 1; visibility: visible; }
.modal {
  position: relative;
  background: linear-gradient(160deg, var(--panel-solid), var(--navy));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: min(560px, 100%);
  box-shadow: var(--shadow), 0 0 60px rgba(0, 229, 255, 0.1);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: auto;
}
.modal-backdrop.show .modal { transform: translateY(0) scale(1); }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  color: var(--text); width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; font-size: 0.95rem; display: grid; place-items: center;
  transition: all 0.15s;
  z-index: 2;
  touch-action: manipulation;
}
.modal-close:hover { background: rgba(255, 86, 120, 0.15); border-color: var(--danger); color: var(--danger); }
.modal-close:active { transform: scale(0.92); }

/* Welcome modal */
.welcome-modal { max-width: 540px; text-align: center; overflow: hidden; }
.modal-glow {
  position: absolute; inset: -50%;
  background: radial-gradient(circle, var(--cyan-glow), transparent 60%);
  pointer-events: none; opacity: 0.5;
}
.welcome-emoji { font-size: 3rem; position: relative; }
.welcome-title { font-size: clamp(1.3rem, 4.5vw, 1.6rem); margin: 10px 0 16px; position: relative; }
.welcome-text { color: var(--muted); font-size: 0.92rem; position: relative; }
.welcome-list { list-style: none; padding: 0; margin: 18px 0; display: flex; flex-direction: column; gap: 8px; text-align: left; font-size: 0.88rem; }
.welcome-cookies {
  font-size: 0.78rem; color: var(--muted);
  background: rgba(0, 0, 0, 0.25); padding: 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  margin: 16px 0;
}
.welcome-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; position: relative; }
.welcome-actions .btn { flex: 1 1 auto; min-width: 130px; }

/* Auth modal */
.auth-modal { max-width: 620px; }
.auth-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: rgba(0, 0, 0, 0.3); border-radius: 999px;
  margin-bottom: 22px; border: 1px solid var(--line);
}
.auth-tab {
  flex: 1; padding: 11px; border-radius: 999px; border: none;
  background: transparent; color: var(--muted); font-weight: 800;
  font-size: 0.88rem; cursor: pointer; transition: all 0.2s;
  min-height: 42px;
  touch-action: manipulation;
}
.auth-tab.active { background: linear-gradient(135deg, var(--cyan), #0099CC); color: #06121F; }
.auth-pane { display: none; }
.auth-pane.active { display: block; }
.auth-title { font-size: 1.35rem; margin-bottom: 6px; padding-right: 40px; }
.auth-sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 20px; }
.auth-error { color: var(--danger); font-size: 0.82rem; margin-top: 12px; min-height: 1em; }

/* Rank modal */
.rank-modal { max-width: 440px; }
#rankModalBody .rank-card { margin-bottom: 18px; }

/* Payment modal */
.pay-modal { max-width: 480px; }
.pay-method-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.pay-method-chip {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 20px; border-radius: 999px; font-weight: 900; letter-spacing: 0.12em;
  font-size: 0.8rem;
  background: linear-gradient(135deg, var(--cyan), #0099CC);
  color: #06121F; box-shadow: 0 0 18px var(--cyan-glow);
}
.qrph-box {
  background: #fff; border-radius: var(--radius);
  padding: 14px; margin-bottom: 18px;
  display: grid; place-items: center;
  min-height: 200px;
  box-shadow: 0 0 30px var(--cyan-glow);
}
.qrph-box img { width: 180px; height: 180px; object-fit: contain; }
.qrph-empty { text-align: center; color: #4A5875; padding: 24px 10px; }
.qrph-empty span { font-size: 2rem; display: block; margin-bottom: 6px; }
.qrph-empty p { margin: 0; font-size: 0.82rem; font-weight: 700; }

/* ---------- Admin Control Deck (FULL PAGE) ---------- */
.admin-page {
  position: fixed; inset: 0; z-index: 1500;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(0, 229, 255, 0.08), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(212, 163, 115, 0.08), transparent 60%),
    var(--navy);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.admin-topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 20, 38, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-top);
}
.admin-topbar-inner {
  width: min(1220px, 94%); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 64px; padding: 8px 0;
}
.admin-brand { display: flex; align-items: center; gap: 12px; }
.admin-brand-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 10px var(--cyan-glow));
}
.admin-brand strong { display: block; font-size: 0.92rem; letter-spacing: 0.1em; }
.admin-brand small { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.06em; }
.admin-topbar-actions { display: flex; align-items: center; gap: 10px; }
.admin-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--cyan); box-shadow: 0 0 14px var(--cyan-glow);
}
.admin-body { width: min(1220px, 94%); margin: 26px auto 80px; padding-bottom: var(--safe-bottom); }
.admin-gate { max-width: 480px; margin: 60px auto; text-align: center; }

.admin-tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 24px;
  background: rgba(0, 0, 0, 0.3); border-radius: 999px;
  border: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  padding: 10px 20px; border-radius: 999px; border: none;
  background: transparent; color: var(--muted); font-weight: 700;
  font-size: 0.84rem; cursor: pointer; white-space: nowrap;
  transition: all 0.2s;
  min-height: 42px;
  touch-action: manipulation;
}
.admin-tab.active { background: linear-gradient(135deg, var(--gold), #C58A5B); color: #14203C; }
.admin-pane { display: none; }
.admin-pane.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.admin-pane h3 { font-size: 1rem; margin: 0 0 14px; color: var(--cyan); letter-spacing: 0.06em; }
.admin-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.admin-list-item {
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line);
  font-size: 0.85rem; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; flex-wrap: wrap;
}
.admin-list-item small { color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row .btn { flex: 1 1 auto; min-width: 140px; }
.dot-online {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 8px var(--success);
  margin-right: 4px;
}

/* Admin scrim items */
.admin-scrim-item {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line);
}
.admin-scrim-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.admin-scrim-head small { display: block; color: var(--muted); font-size: 0.76rem; }
.admin-scrim-qr { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-scrim-qr img {
  width: 96px; height: 96px; object-fit: contain;
  background: #fff; border-radius: 10px; padding: 5px;
}
.qr-missing {
  width: 96px; height: 96px; border-radius: 10px;
  border: 1px dashed var(--line); display: grid; place-items: center;
  font-size: 0.7rem; color: var(--muted); text-align: center; padding: 6px;
}
.admin-scrim-qr-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Admin payment items */
.admin-payment-item {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px;
}
.admin-payment-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.admin-payment-head small { display: block; color: var(--muted); font-size: 0.76rem; }
.receipt-thumb img {
  width: 70px; height: 70px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line);
}
.status-pending { color: #FFB37A; font-weight: 800; text-transform: uppercase; }
.status-approved { color: var(--success); font-weight: 800; text-transform: uppercase; }
.status-rejected { color: var(--danger); font-weight: 800; text-transform: uppercase; }

/* QRPH admin */
.qrph-admin-box { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.qrph-admin-box img {
  width: 160px; height: 160px; object-fit: contain;
  background: #fff; border-radius: var(--radius); padding: 8px;
  box-shadow: 0 0 24px var(--cyan-glow);
}
.qrph-admin-actions { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 10px; }
.qrph-admin-actions .input { margin: 0; }

/* Badge grid */
.badge-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px; margin-top: 8px;
}
.badge-item {
  position: relative;
  padding: 12px 10px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line);
  text-align: center; font-size: 0.72rem;
}
.badge-item img { width: 48px; height: 48px; object-fit: contain; margin: 0 auto 6px; }
.badge-item .badge-type {
  display: block; color: var(--muted); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px;
}
.badge-item .btn {
  position: absolute; top: 6px; right: 6px;
  padding: 0; width: 24px; height: 24px; min-height: 0;
  font-size: 0.7rem; border-radius: 50%;
}

/* Toast */
.toast-stack {
  position: fixed; bottom: calc(20px + var(--safe-bottom)); right: 16px; left: 16px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  align-items: flex-end;
}
.toast {
  padding: 12px 20px; border-radius: 999px;
  background: rgba(19, 34, 68, 0.98); border: 1px solid var(--cyan);
  color: var(--text); font-weight: 700; font-size: 0.85rem;
  box-shadow: 0 0 20px var(--cyan-glow);
  animation: toastIn 0.3s ease;
  max-width: 100%;
  word-break: break-word;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.toast.error { border-color: var(--danger); box-shadow: 0 0 20px rgba(255, 86, 120, 0.35); }
.toast.success { border-color: var(--success); box-shadow: 0 0 20px rgba(74, 222, 128, 0.35); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Responsive: Tablet ---------- */
@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; gap: 30px; }
  .hero-visual { display: none; }
  .converter { grid-template-columns: 1fr; gap: 20px; }
  .footer-inner { grid-template-columns: 1fr; text-align: center; }
  .footer-legal { text-align: center; }
  .footer-brand { justify-content: center; }
  .footer-links { justify-content: center; }
  .section { padding: 64px 0; }
}

/* ---------- Responsive: Mobile ---------- */
@media (max-width: 720px) {
  :root { --nav-h: 58px; }

  .nav-inner { gap: 8px; }
  .brand-text { font-size: 0.88rem; }
  .brand-text em { font-size: 0.55rem; letter-spacing: 0.28em; }

  .nav-links {
    position: fixed; top: calc(var(--nav-h) + var(--safe-top)); left: 0; right: 0;
    flex-direction: column; padding: 14px;
    background: rgba(11, 20, 38, 0.98);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    max-height: calc(100dvh - var(--nav-h) - var(--safe-top));
    overflow-y: auto;
    transform: translateY(-12px);
    opacity: 0; visibility: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    gap: 4px;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; visibility: visible; }
  .nav-link {
    width: 100%;
    padding: 14px 16px;
    min-height: 52px;
    font-size: 1rem;
    border-radius: 12px;
    justify-content: flex-start;
  }

  .nav-toggle { display: inline-flex; }
  .nav-actions #btnLogin,
  .nav-actions #btnRegister { padding: 10px 16px; font-size: 0.85rem; }

  /* Hero */
  .hero { padding: 48px 0 40px; }
  .hero-title { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .hero-sub { font-size: 0.94rem; }
  .hero-cta { gap: 10px; }
  .hero-cta .btn { flex: 1 1 100%; padding: 15px 22px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-pill { padding: 12px 8px; }
  .stat-pill strong { font-size: 1.15rem; }
  .stat-pill span { font-size: 0.62rem; }

  .section { padding: 52px 0; }
  .section-head { margin-bottom: 24px; gap: 14px; }
  .section-head > .segmented { width: 100%; }
  .section-title { font-size: clamp(1.5rem, 7vw, 2rem); }
  .section-sub { font-size: 0.88rem; }

  .grid { gap: 14px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .panel { padding: 18px; border-radius: 18px; }
  .rank-card { padding: 18px; }
  .rank-position { font-size: 1.2rem; }
  .rank-card-head img { width: 50px; height: 50px; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr; }
  .input { font-size: 16px; padding: 13px 14px; }

  /* Chat */
  .chat-window { height: min(58vh, 420px); padding: 16px; }
  .msg { max-width: 92%; }
  .chat-input { padding: 12px; gap: 8px; }
  .chat-input input { padding: 12px 14px; }
  .chat-input .btn { padding: 12px 18px; }

  /* Scrim cards stack */
  .scrim-card { flex-direction: column; align-items: stretch; }
  .scrim-qr { align-self: center; }

  /* Converter stacks */
  .converter-form { flex-direction: column; align-items: stretch; gap: 12px; }
  .converter-equals { text-align: center; padding: 0; font-size: 1.2rem; }
  .converter-form .btn { width: 100%; }
  .converter-result { min-width: 0; }

  .messenger-link { font-size: 0.8rem; }

  .tier-card { padding: 22px 18px; }
  .tier-price .amount { font-size: 1.85rem; }

  /* Modals → Bottom Sheets */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
    padding-top: calc(16px + var(--safe-top));
  }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - var(--safe-top) - 16px);
    border-radius: 22px 22px 0 0;
    padding: 22px 20px calc(22px + var(--safe-bottom));
    transform: translateY(100%);
    margin: 0;
  }
  .modal-backdrop.show .modal { transform: translateY(0); }

  .modal::before {
    content: '';
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 42px; height: 4px; border-radius: 999px;
    background: rgba(143, 161, 191, 0.4);
    pointer-events: none;
  }
  .modal-close { top: 14px; right: 14px; width: 38px; height: 38px; }

  .auth-modal, .rank-modal, .pay-modal, .welcome-modal { max-width: 100%; }

  /* Toast */
  .toast-stack { left: 12px; right: 12px; align-items: stretch; }
  .toast { text-align: center; }

  .welcome-actions .btn { flex: 1 1 100%; }

  /* Admin page on mobile */
  .admin-body { margin: 18px auto 60px; }
  .admin-topbar-inner { min-height: 58px; }
  .admin-brand strong { font-size: 0.8rem; }
  .admin-brand small { font-size: 0.62rem; }
  .admin-avatar { width: 34px; height: 34px; }
  .admin-tab { padding: 9px 16px; font-size: 0.78rem; }
  .admin-scrim-qr { flex-direction: column; align-items: stretch; }
  .admin-scrim-qr img, .qr-missing { align-self: center; }
  .admin-scrim-qr-actions { width: 100%; }
  .admin-scrim-qr-actions .btn { flex: 1; }
  .qrph-admin-box { flex-direction: column; }
  .qrph-admin-box img { align-self: center; }
}

/* ---------- Very small phones ---------- */
@media (max-width: 380px) {
  .brand-text { font-size: 0.8rem; }
  .hero-title { font-size: 1.75rem; }
  .btn { padding: 11px 18px; font-size: 0.86rem; }
  .btn-lg { padding: 13px 22px; font-size: 0.94rem; }
  .stat-pill strong { font-size: 1rem; }
}

/* ---------- Landscape phone (short height) ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding: 40px 0 30px; }
  .chat-window { height: 60vh; }
  .modal-backdrop { align-items: flex-start; }
  .modal { max-height: calc(100dvh - 24px); border-radius: 18px; margin-top: 12px; }
}

/* ---------- Accessibility: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}