/* ============================================================
   family-viral.css — Gamify family viral loop styles.
   Matches the app theme: --bg, --surface, --surface2, --purple,
   --green, --amber, --orange, --pink, --radius, --font, --mono.
   ============================================================ */

/* ---------- Family page ---------- */
#page-family .fvl-hero {
  background: linear-gradient(135deg, rgba(139,131,232,0.16), rgba(29,184,122,0.10));
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
#page-family .fvl-hero::after {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,131,232,0.35), transparent 70%);
  pointer-events: none;
}
.fvl-hero-title { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px; }
.fvl-hero-sub { font-size: 13px; color: var(--muted); font-family: var(--mono); }

.fvl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.fvl-lock-card {
  text-align: center;
  padding: 26px 18px;
  color: var(--muted);
}
.fvl-lock-card .fvl-lock-emoji { font-size: 34px; margin-bottom: 10px; }
.fvl-lock-card .fvl-lock-title { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.fvl-lock-card .fvl-lock-sub { font-size: 13px; font-family: var(--mono); }

/* ---------- Invite / referral ---------- */
.fvl-code-box {
  flex: 1;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--green);
  background: var(--surface2);
  border: 1px dashed rgba(29,184,122,0.4);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: center;
}
.fvl-btn {
  background: var(--green);
  border: none;
  border-radius: var(--radius-sm);
  color: #06130c;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 800;
  padding: 12px 18px;
  cursor: pointer;
  white-space: nowrap;
}
.fvl-btn.ghost {
  background: var(--surface2);
  color: var(--green);
  border: 1px solid rgba(29,184,122,0.35);
}
.fvl-btn.purple { background: var(--purple); color: #0a0a12; }
.fvl-btn.purple-ghost { background: var(--surface2); color: var(--purple); border: 1px solid rgba(139,131,232,0.35); }
.fvl-btn-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.fvl-rewards { font-size: 12px; color: var(--muted); line-height: 1.55; margin-bottom: 10px; }
.fvl-rewards b { color: var(--text); }
.fvl-status { font-size: 11px; color: var(--hint); font-family: var(--mono); }

/* ---------- Challenges ---------- */
.fvl-chal {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.fvl-chal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.fvl-chal-name { font-size: 14px; font-weight: 800; }
.fvl-chal-meta { font-size: 11px; color: var(--hint); font-family: var(--mono); margin-bottom: 10px; }
.fvl-chal-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.fvl-chal-fam { font-size: 12px; font-weight: 700; width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fvl-chal-bar { flex: 1; height: 10px; background: rgba(255,255,255,0.06); border-radius: 6px; overflow: hidden; }
.fvl-chal-fill { height: 100%; border-radius: 6px; transition: width 0.6s ease; }
.fvl-chal-score { font-size: 12px; font-family: var(--mono); color: var(--muted); width: 54px; text-align: right; }
.fvl-badge {
  font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 20px; font-family: var(--mono);
}
.fvl-badge.live { background: rgba(29,184,122,0.15); color: var(--green); }
.fvl-badge.won { background: rgba(240,164,41,0.18); color: var(--amber); }
.fvl-badge.lost { background: rgba(255,255,255,0.08); color: var(--muted); }
.fvl-form-row { display: flex; gap: 8px; margin-bottom: 10px; }
.fvl-input {
  flex: 1; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font);
  font-size: 14px; padding: 12px; outline: none; min-width: 0;
}
.fvl-input:focus { border-color: var(--purple); }
select.fvl-input { flex: 0 0 auto; }

/* ---------- Celebration overlay ---------- */
#fvl-celebration {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(5,5,15,0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fvl-fade-in 0.35s ease;
  overflow-y: auto;
}
@keyframes fvl-fade-in { from { opacity: 0; } to { opacity: 1; } }
.fvl-cel-sheet {
  width: 100%; max-width: 380px; text-align: center; position: relative;
  animation: fvl-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes fvl-pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.fvl-cel-emoji { font-size: 64px; margin-bottom: 8px; animation: fvl-bounce 1.2s ease infinite; display: inline-block; }
@keyframes fvl-bounce { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-12px) scale(1.08); } }
.fvl-cel-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.fvl-cel-sub { font-size: 14px; color: var(--muted); font-family: var(--mono); margin-bottom: 16px; }
.fvl-cel-card { border-radius: var(--radius); overflow: hidden; margin: 0 auto 16px; max-width: 300px; box-shadow: 0 18px 60px rgba(139,131,232,0.35); }
.fvl-cel-card img, .fvl-cel-card canvas { width: 100%; display: block; }
.fvl-cel-actions { display: flex; flex-direction: column; gap: 10px; }
.fvl-cel-actions .fvl-btn, .fvl-cel-actions .link-btn { width: 100%; margin: 0; }
.fvl-confetti { position: absolute; top: -10px; width: 10px; height: 16px; border-radius: 2px; animation: fvl-fall linear forwards; pointer-events: none; }
@keyframes fvl-fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }
.fvl-rays {
  position: absolute; top: 40px; left: 50%; width: 420px; height: 420px;
  transform: translateX(-50%); pointer-events: none; opacity: 0.5;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(139,131,232,0.25) 12deg, transparent 24deg, transparent 36deg, rgba(240,164,41,0.22) 48deg, transparent 60deg, transparent 72deg, rgba(29,184,122,0.22) 84deg, transparent 96deg, transparent 108deg, rgba(139,131,232,0.25) 120deg, transparent 132deg, transparent 144deg, rgba(240,164,41,0.22) 156deg, transparent 168deg, transparent 180deg, rgba(29,184,122,0.22) 192deg, transparent 204deg, transparent 216deg, rgba(139,131,232,0.25) 228deg, transparent 240deg, transparent 252deg, rgba(240,164,41,0.22) 264deg, transparent 276deg, transparent 288deg, rgba(29,184,122,0.22) 300deg, transparent 312deg, transparent 324deg, rgba(139,131,232,0.25) 336deg, transparent 348deg);
  border-radius: 50%;
  animation: fvl-spin 14s linear infinite;
}
@keyframes fvl-spin { to { transform: translateX(-50%) rotate(360deg); } }

/* ---------- Share sheet ---------- */
#fvl-share-sheet {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(5,5,15,0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fvl-fade-in 0.25s ease;
}
.fvl-sheet {
  width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 22px 22px 0 0; padding: 20px 18px 28px;
  animation: fvl-slide-up 0.3s ease;
}
@keyframes fvl-slide-up { from { transform: translateY(60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.fvl-sheet-title { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.fvl-sheet-sub { font-size: 12px; color: var(--muted); font-family: var(--mono); margin-bottom: 14px; }
.fvl-format-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.fvl-format-tab {
  flex: 1; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border2);
  background: var(--surface2); color: var(--muted); font-family: var(--font);
  font-size: 12px; font-weight: 700; cursor: pointer; text-align: center;
}
.fvl-format-tab.active { border-color: var(--purple); background: var(--purple-dim); color: var(--purple); }
.fvl-preview { border-radius: var(--radius-sm); overflow: hidden; margin: 0 auto 14px; max-width: 260px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.fvl-preview.tall { max-width: 170px; }
.fvl-preview img, .fvl-preview canvas { width: 100%; display: block; }
.fvl-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.fvl-caption {
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; font-size: 12px; color: var(--muted); font-family: var(--mono);
  line-height: 1.55; margin-bottom: 10px; white-space: pre-wrap; word-break: break-word;
}

/* ---------- Parent approval sheet ---------- */
#fvl-approval {
  position: fixed; inset: 0; z-index: 10001;
  background: rgba(5,5,15,0.94);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fvl-fade-in 0.25s ease;
}
.fvl-approval-sheet {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border2); border-radius: var(--radius); padding: 24px 20px;
  text-align: center; animation: fvl-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.fvl-approval-emoji { font-size: 44px; margin-bottom: 10px; }
.fvl-approval-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.fvl-approval-body { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 16px; }
.fvl-approval-body b { color: var(--text); }

/* ---------- Privacy toggles ---------- */
.fvl-pref-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.fvl-pref-row:last-child { border-bottom: none; }
.fvl-pref-text { flex: 1; min-width: 0; }
.fvl-pref-label { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.fvl-pref-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.fvl-kid-tag {
  font-size: 10px; font-weight: 800; font-family: var(--mono); letter-spacing: 0.05em;
  background: rgba(212,83,126,0.15); color: var(--pink);
  padding: 3px 8px; border-radius: 12px; margin-left: 8px; vertical-align: middle;
}
.fvl-locked-tag {
  font-size: 10px; font-weight: 800; font-family: var(--mono); letter-spacing: 0.05em;
  background: rgba(255,255,255,0.07); color: var(--muted);
  padding: 3px 8px; border-radius: 12px; margin-left: 8px; vertical-align: middle;
}

/* ---------- Seat controls (injected) ---------- */
.fvl-seat-controls { display: flex; gap: 6px; margin-top: 8px; }
.fvl-seat-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); font-size: 11px; font-weight: 700; padding: 5px 10px; cursor: pointer;
  font-family: var(--font);
}
.fvl-seat-btn.on { border-color: var(--pink); color: var(--pink); background: rgba(212,83,126,0.08); }
.fvl-seat-btn.share-on { border-color: var(--green); color: var(--green); background: rgba(29,184,122,0.08); }

/* ---------- Leaderboard ---------- */
.fvl-lb-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.fvl-lb-row:last-child { border-bottom: none; }
.fvl-lb-rank { font-size: 16px; font-weight: 800; font-family: var(--mono); width: 34px; color: var(--amber); }
.fvl-lb-name { flex: 1; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fvl-lb-score { font-size: 12px; font-family: var(--mono); color: var(--muted); }

/* ---------- Switch (matches app switch style) ---------- */
.fvl-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.fvl-switch input { opacity: 0; width: 0; height: 0; }
.fvl-switch-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 26px; transition: 0.2s;
}
.fvl-switch-slider::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: var(--muted); border-radius: 50%; transition: 0.2s;
}
.fvl-switch input:checked + .fvl-switch-slider { background: var(--green-dim); border-color: var(--green); }
.fvl-switch input:checked + .fvl-switch-slider::before { transform: translateX(20px); background: var(--green); }

.fvl-note { font-size: 11px; color: var(--hint); font-family: var(--mono); line-height: 1.6; margin-top: 10px; }
.fvl-share-center-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fvl-share-tile {
  background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 10px; text-align: center; cursor: pointer;
}
.fvl-share-tile .fvl-tile-emoji { font-size: 28px; margin-bottom: 6px; }
.fvl-share-tile .fvl-tile-label { font-size: 12px; font-weight: 800; }
.fvl-share-tile .fvl-tile-sub { font-size: 10px; color: var(--hint); font-family: var(--mono); margin-top: 3px; }
.fvl-share-tile:active { transform: scale(0.97); }

/* ---------- Family Core (server-backed family, 2026-10-15) ---------- */
.fvc-payday { border: 1px solid rgba(240,164,41,0.45); background: rgba(240,164,41,0.10); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; }
.fvc-payday-title { font-size: 13px; font-weight: 800; color: var(--amber); }
.fvc-payday-sub { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.fvc-member { border-top: 1px solid var(--border); padding: 10px 0; }
.fvc-member:first-of-type { border-top: none; }
.fvc-member-head { display: flex; align-items: center; gap: 8px; }
.fvc-member-name { font-size: 14px; font-weight: 800; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fvc-tag { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 20px; background: var(--surface2); color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
.fvc-tag.admin { background: rgba(139,131,232,0.18); color: var(--purple); }
.fvc-progress { height: 8px; background: rgba(255,255,255,0.06); border-radius: 6px; overflow: hidden; margin: 8px 0 4px; }
.fvc-progress-fill { height: 100%; background: var(--green); border-radius: 6px; }
.fvc-meta { font-size: 11px; color: var(--hint); font-family: var(--mono); margin-top: 2px; }
.fvc-detail { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.55; }
.fvc-row-btns { display: flex; gap: 8px; margin-top: 8px; }
.fvc-btn { flex: 1; padding: 9px 10px; font-size: 12px; font-weight: 700; border-radius: var(--radius-sm); border: 1px solid var(--border2); background: var(--surface2); color: var(--text); cursor: pointer; }
.fvc-btn.primary { background: var(--purple); color: #0a0a12; border-color: transparent; }
.fvc-btn.danger { color: #ff7a7a; }
.fvc-btn:disabled { opacity: 0.5; }
.fvc-day-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.fvc-day-chip { padding: 7px 10px; font-size: 11px; font-weight: 700; border-radius: 20px; border: 1px solid var(--border2); background: var(--surface2); color: var(--muted); cursor: pointer; }
.fvc-day-chip.on { background: var(--purple-dim); color: var(--purple); border-color: var(--purple); }
.fvc-assign { border-top: 1px solid var(--border); padding: 9px 0; font-size: 13px; }
.fvc-assign:first-of-type { border-top: none; }
