/* ============================================================
   MSN CLIPS — Facebook Reels Design
   Profile grid · Fullscreen reel modal · Right action rail
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

/* ── Shared buttons ─────────────────────────────────────────── */
.msn-fb-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 999px;
  border: 1.5px solid rgba(0,0,0,.15);
  background: rgba(0,0,0,.06); color: #111;
  font-size: 13px; font-weight: 800; cursor: pointer;
  text-decoration: none; transition: background .18s;
}
.msn-fb-pill:hover { background: rgba(0,0,0,.1); }
.msn-fb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border-radius: 12px; border: none;
  background: #1877f2; color: #fff; font-size: 14px; font-weight: 800;
  cursor: pointer; transition: background .18s, transform .15s;
}
.msn-fb-btn:hover  { background: #0d6efd; }
.msn-fb-btn:active { transform: scale(.97); }
.msn-fb-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════════
   PROFILE CLIPS — 3-COLUMN THUMBNAIL GRID
   ══════════════════════════════════════════════════════════════ */
.msn-profile-clips-wrap { width: 100%; }

.msn-profile-clips-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px 10px;
}
.msn-profile-clips-title { font-size: 17px; font-weight: 900; color: #111; }

.msn-profile-clips-create-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px; border: none;
  background: #1877f2; color: #fff; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: background .18s;
}
.msn-profile-clips-create-btn:hover { background: #0d6efd; }

/* 3-col grid */
.msn-profile-clips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

/* thumb */
.msn-clips-grid-thumb {
  position: relative; width: 100%; aspect-ratio: 9/16;
  background: #111 center/cover no-repeat;
  border: none; cursor: pointer; overflow: hidden; display: block; padding: 0;
}
.msn-clips-grid-thumb-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.28); opacity: 0; transition: opacity .18s;
}
.msn-clips-grid-thumb:hover .msn-clips-grid-thumb-play { opacity: 1; }
.msn-clips-grid-thumb-views {
  position: absolute; bottom: 6px; left: 6px;
  display: flex; align-items: center; gap: 2px;
  font-size: 12px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}
.msn-clips-grid-thumb-badge {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 10px; font-weight: 800; padding: 2px 7px;
  border-radius: 999px; backdrop-filter: blur(4px);
}

.msn-profile-clips-load-more {
  margin: 14px auto 0; display: flex;
  border-color: rgba(0,0,0,.18); background: rgba(0,0,0,.05); color: #111;
}
.msn-profile-clips-load-more:hover { background: rgba(0,0,0,.1); }

/* ── Empty state ──────────────────────────────────────────── */
.msn-profile-clips-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 52px 24px 40px; text-align: center; gap: 14px;
}
.msn-profile-clips-empty-icon { width: 80px; height: 80px; margin-bottom: 4px; }
.msn-profile-clips-empty-icon svg { width: 80px; height: 80px; display: block; }
.msn-profile-clips-empty-title { font-size: 22px; font-weight: 900; color: #111; }
.msn-profile-clips-empty-sub { font-size: 14px; font-weight: 600; color: #6b7280; max-width: 260px; line-height: 1.5; }
.msn-profile-clips-create-big {
  margin-top: 6px; padding: 12px 32px; border-radius: 999px;
  border: none; background: #1877f2; color: #fff;
  font-size: 15px; font-weight: 900; cursor: pointer;
  transition: background .18s, transform .15s;
}
.msn-profile-clips-create-big:hover  { background: #0d6efd; }
.msn-profile-clips-create-big:active { transform: scale(.97); }

/* ══════════════════════════════════════════════════════════════
   FULLSCREEN REEL MODAL
   Fixed, covers header/nav, edge-to-edge
   ══════════════════════════════════════════════════════════════ */
.msn-reel-modal[hidden] { display: none !important; }
.msn-reel-modal {
  position: fixed; inset: 0; z-index: 999900; background: #000;
  display: flex; flex-direction: column; overflow: hidden;
}

/* top bar */
.msn-reel-modal-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 50;
  padding: env(safe-area-inset-top, 12px) 16px 8px;
  background: linear-gradient(to bottom, rgba(0,0,0,.75) 0%, transparent 100%);
  display: flex; align-items: center; pointer-events: none;
}
.msn-reel-modal-back {
  pointer-events: all;
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: #fff;
  font-size: 18px; font-weight: 900; cursor: pointer;
  padding: 10px 10px 10px 4px; border-radius: 12px;
  transition: background .15s; text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.msn-reel-modal-back:hover { background: rgba(255,255,255,.12); }

/* vertical snap feed */
.msn-reel-modal-feed {
  flex: 1; height: 100svh; overflow-y: auto; overflow-x: hidden;
  scroll-snap-type: y mandatory; scroll-snap-stop: always;
  background: #000; scrollbar-width: none;
}
.msn-reel-modal-feed::-webkit-scrollbar { display: none; }

/* loading spinner */
.msn-reel-modal-loading {
  display: flex; align-items: center; justify-content: center; height: 100svh;
}
.msn-reel-spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(255,255,255,.15); border-top-color: #fff;
  border-radius: 50%; animation: msn-spin .8s linear infinite;
}
@keyframes msn-spin { to { transform: rotate(360deg); } }

/* ── Clip screens ─────────────────────────────────────────── */
.msn-clips-screen {
  height: 100svh; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: stretch;
}

/* ══════════════════════════════════════════════════════════════
   CLIP CARD  — fullscreen, Facebook-Reels style
   ══════════════════════════════════════════════════════════════ */
.msn-clip-card {
  position: relative; width: 100%; height: 100svh;
  background: #000; overflow: hidden; display: block;
}

.msn-clip-player-wrap {
  position: relative; width: 100%; height: 100%; background: #000;
  overflow: hidden; display: grid; grid-template-columns: 1fr;
}
.msn-clip-player-wrap.is-duet { grid-template-columns: 1fr 1fr; }

/* gradient overlays */
.msn-clip-player-wrap::before,
.msn-clip-player-wrap::after {
  content:''; position: absolute; inset: 0; z-index: 2; pointer-events: none;
}
.msn-clip-player-wrap::before {
  background: linear-gradient(to top,
    rgba(0,0,0,.88) 0%, rgba(0,0,0,.55) 22%,
    rgba(0,0,0,.1) 50%, transparent 70%);
}
.msn-clip-player-wrap::after {
  background: linear-gradient(to bottom, rgba(0,0,0,.5) 0%, transparent 30%);
}

.msn-clip-duet-pane        { position: relative; height: 100%; }
.msn-clip-duet-pane video  { width:100%; height:100%; object-fit:cover; display:block; background:#000; }

.msn-clip-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; background: #000; z-index: 1;
}

/* effects */
.effect-bw     .msn-clip-video { filter: grayscale(1); }
.effect-cinema .msn-clip-video { filter: contrast(1.12) saturate(1.15) brightness(.9); }
.effect-warm   .msn-clip-video { filter: sepia(.22) saturate(1.2) hue-rotate(-8deg); }
.effect-cool   .msn-clip-video { filter: hue-rotate(22deg) saturate(1.08); }
.effect-vivid  .msn-clip-video { filter: saturate(1.45) contrast(1.1); }

/* progress bar */
.msn-clip-progress-wrap { position:absolute; top:0; left:0; right:0; height:3px; background:rgba(255,255,255,.18); z-index:20; }
.msn-clip-progress-bar { height:100%; width:0%; background:#fff; border-radius:0 2px 2px 0; transition:width .1s linear; }

/* tap-for-sound */
.msn-clip-tap-sound {
  position: absolute; top:50%; left:50%;
  transform: translate(-50%,-50%) scale(.9); z-index:15;
  display: flex; flex-direction:column; align-items:center; gap:8px;
  background: rgba(0,0,0,.52); backdrop-filter:blur(8px);
  border: 1.5px solid rgba(255,255,255,.18); border-radius:20px;
  padding: 16px 22px; color:#fff; font-size:13px; font-weight:800;
  cursor:pointer; opacity:1; transition: opacity .3s, transform .3s;
}
.msn-clip-tap-sound svg { width:28px; height:28px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.msn-clip-tap-sound.is-hidden { opacity:0; pointer-events:none; transform:translate(-50%,-50%) scale(.8); }

/* double-tap heart */
.msn-clip-dbl-heart { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%) scale(0); z-index:30; pointer-events:none; opacity:0; }
.msn-clip-dbl-heart svg { width:100px; height:100px; fill:#ff3040; stroke:none; filter:drop-shadow(0 4px 24px rgba(255,48,64,.7)); }
@keyframes msn-heart-burst {
  0%   { transform:translate(-50%,-50%) scale(0);   opacity:0; }
  20%  { transform:translate(-50%,-50%) scale(1.3); opacity:1; }
  60%  { transform:translate(-50%,-50%) scale(1.1); opacity:1; }
  100% { transform:translate(-50%,-50%) scale(1.6); opacity:0; }
}
.msn-clip-dbl-heart.is-burst { animation: msn-heart-burst .65s cubic-bezier(.36,.07,.19,.97) forwards; }

/* ── RIGHT ACTION RAIL ──────────────────────────────────────── */
.msn-clip-rail { position:absolute; right:14px; bottom:96px; z-index:10; display:flex; flex-direction:column; align-items:center; gap:18px; }

.msn-clip-rail-avatar { position:relative; width:48px; height:48px; margin-bottom:4px; }
.msn-clip-rail-avatar img,
.msn-clip-rail-avatar .msn-avatar,
.msn-clip-rail-avatar .avatar { width:48px!important; height:48px!important; border-radius:50%!important; border:2.5px solid #fff!important; display:block!important; object-fit:cover!important; }

.msn-clip-rail-follow-plus {
  position:absolute; bottom:-10px; left:50%; transform:translateX(-50%);
  width:22px; height:22px; border-radius:50%; background:#1877f2; border:2px solid #000;
  color:#fff; font-size:15px; font-weight:900; line-height:1;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  transition: background .18s, transform .15s;
}
.msn-clip-rail-follow-plus:hover    { transform:translateX(-50%) scale(1.15); background:#0d6efd; }
.msn-clip-rail-follow-plus.is-following { background:#22c55e; }

.msn-clip-rail-btn { display:flex; flex-direction:column; align-items:center; gap:5px; background:none; border:none; cursor:pointer; padding:0; color:#fff; }
.msn-clip-rail-icon {
  width:48px; height:48px; border-radius:50%;
  background:rgba(255,255,255,.14); backdrop-filter:blur(6px);
  display:flex; align-items:center; justify-content:center;
  transition: background .18s, transform .15s;
}
.msn-clip-rail-btn:hover .msn-clip-rail-icon { background:rgba(255,255,255,.26); transform:scale(1.1); }
.msn-clip-rail-icon svg { width:22px; height:22px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.msn-clip-rail-label { font-size:12px; font-weight:800; color:#fff; text-shadow:0 1px 4px rgba(0,0,0,.7); letter-spacing:.01em; }

@keyframes msn-like-pop { 0%{transform:scale(1)}40%{transform:scale(1.35)}70%{transform:scale(.88)}100%{transform:scale(1)} }
.msn-clip-like-btn.is-liked .msn-clip-rail-icon { background:rgba(255,48,64,.22); animation:msn-like-pop .4s cubic-bezier(.36,.07,.19,.97); }
.msn-clip-like-btn.is-liked .msn-clip-rail-icon svg { fill:#ff3040; stroke:#ff3040; }
.msn-clip-save-btn.is-active .msn-clip-rail-icon { background:rgba(250,204,21,.18); }
.msn-clip-save-btn.is-active .msn-clip-rail-icon svg { fill:#facc15; stroke:#facc15; }

/* spinning disc */
.msn-clip-disc { position:relative; width:46px; height:46px; border-radius:50%; overflow:hidden; border:3px solid rgba(255,255,255,.3); margin-top:6px; }
.msn-clip-disc-img { position:absolute; inset:0; background:#1a1a2e center/cover no-repeat; border-radius:50%; }
.msn-clip-disc-hole { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:12px; height:12px; border-radius:50%; background:#000; border:2px solid rgba(255,255,255,.35); z-index:2; }
@keyframes msn-disc-spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
.msn-clip-disc-img { animation:msn-disc-spin 4s linear infinite; animation-play-state:paused; }
.msn-clip-card.is-playing .msn-clip-disc-img { animation-play-state:running; }

/* ── BOTTOM INFO BAR ────────────────────────────────────────── */
.msn-clip-info { position:absolute; bottom:0; left:0; right:78px; z-index:10; padding:0 16px 28px; display:flex; flex-direction:column; gap:6px; }
.msn-clip-creator-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.msn-clip-creator-name { font-size:15px; font-weight:900; color:#fff; text-shadow:0 1px 6px rgba(0,0,0,.6); }
.msn-clip-follow-btn,
.msn-clip-inline-delete {
  padding:5px 14px; border-radius:999px; border:1.5px solid rgba(255,255,255,.75);
  background:transparent; color:#fff; font-size:13px; font-weight:800; cursor:pointer;
  transition:background .18s; line-height:1;
}
.msn-clip-follow-btn:hover { background:rgba(255,255,255,.15); }
.msn-clip-follow-btn.is-active { background:rgba(255,255,255,.18); }
.msn-clip-inline-delete { border-color:rgba(255,80,80,.7); color:rgba(255,120,120,.9); }
.msn-clip-inline-delete:hover { background:rgba(255,80,80,.18); }
.msn-clip-caption { font-size:14px; font-weight:600; color:rgba(255,255,255,.93); line-height:1.45; text-shadow:0 1px 4px rgba(0,0,0,.5); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.msn-clip-caption p { margin:0; }
.msn-clip-tags { display:flex; flex-wrap:wrap; gap:6px; }
.msn-clip-tags a { font-size:13px; font-weight:800; color:#e0f2fe; text-decoration:none; transition:color .15s; }
.msn-clip-tags a:hover { color:#7dd3fc; }
.msn-clip-sound-row { display:flex; align-items:center; gap:8px; overflow:hidden; }
.msn-clip-sound-note svg { width:16px; height:16px; fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }
.msn-clip-sound-marquee { overflow:hidden; flex:1; min-width:0; }
.msn-clip-sound-text { display:inline-block; font-size:13px; font-weight:700; color:rgba(255,255,255,.82); white-space:nowrap; }
@keyframes msn-marquee { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }
.msn-clip-card.is-playing .msn-clip-sound-text { animation:msn-marquee 10s linear infinite; }

/* hidden legacy */
.msn-clip-stats { position:absolute; bottom:0; left:0; opacity:0; pointer-events:none; font-size:1px; }
.msn-clip-views-count { font-size:1px; }
.msn-clip-comments { display:none!important; }

/* ── MODALS ─────────────────────────────────────────────────── */
.msn-clips-modal[hidden] { display:none!important; }
.msn-clips-modal { position:fixed; inset:0; z-index:999950; display:flex; align-items:center; justify-content:center; padding:16px; }
.msn-clips-modal-backdrop { position:absolute; inset:0; background:rgba(0,0,0,.72); backdrop-filter:blur(6px); }
.msn-clips-modal-dialog { position:relative; z-index:1; background:#0f172a; border-radius:20px; border:1px solid rgba(255,255,255,.1); width:min(500px,100%); max-height:90svh; display:flex; flex-direction:column; box-shadow:0 24px 60px rgba(0,0,0,.7); }
.msn-clips-modal-head { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid rgba(255,255,255,.08); font-size:17px; font-weight:900; color:#fff; }
.msn-clips-modal-close { width:36px; height:36px; border:none; background:rgba(255,255,255,.1); border-radius:50%; color:#fff; font-size:20px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background .18s; }
.msn-clips-modal-close:hover { background:rgba(255,255,255,.2); }
.msn-clips-modal-body { overflow-y:auto; padding:18px 20px; flex:1; scrollbar-width:thin; }

.msn-clips-modal-body textarea,
.msn-clips-modal-body input[type="text"],
.msn-clips-modal-body input[type="url"],
.msn-clips-modal-body input[type="number"],
.msn-clips-modal-body select {
  width:100%; padding:10px 14px; border:1px solid rgba(255,255,255,.12); border-radius:12px;
  background:rgba(255,255,255,.07); color:#f1f5f9; font-size:14px; font-weight:600; outline:none; transition:border-color .2s;
}
.msn-clips-modal-body textarea:focus, .msn-clips-modal-body input:focus { border-color:#1877f2; }
.msn-clips-modal-body label { color:#cbd5e1; font-size:13px; font-weight:700; }
.msn-clips-modal-body select option { background:#1e293b; }
.msn-clips-grid-2,.msn-clips-grid-3,.msn-clips-grid-4 { display:grid; gap:10px; margin-top:10px; }
.msn-clips-grid-2{grid-template-columns:repeat(2,1fr)}.msn-clips-grid-3{grid-template-columns:repeat(3,1fr)}.msn-clips-grid-4{grid-template-columns:repeat(4,1fr)}
.msn-clips-section-label { font-size:11px; font-weight:800; color:rgba(255,255,255,.45); text-transform:uppercase; letter-spacing:.08em; margin:14px 0 6px; }
.msn-clips-checkbox { display:flex; align-items:center; gap:8px; font-size:13px; font-weight:700; color:#cbd5e1; }
.msn-clips-file-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.msn-clips-file-name,.msn-clips-cover-name { font-size:12px; font-weight:700; color:rgba(255,255,255,.5); }
.msn-clips-upload-status { font-size:13px; font-weight:700; color:#6ee7b7; margin-top:8px; }
.msn-clips-remix-target { margin-top:8px; padding:10px 14px; border-radius:12px; background:rgba(24,119,242,.15); border:1px solid rgba(24,119,242,.35); font-size:13px; font-weight:700; color:#93c5fd; }

/* ── COMMENT DRAWER ─────────────────────────────────────────── */
.msn-clips-comment-drawer[hidden] { display:none!important; }
.msn-clips-comment-drawer { position:fixed; inset:0; z-index:999960; }
.msn-clips-comment-backdrop { position:absolute; inset:0; background:rgba(0,0,0,.55); backdrop-filter:blur(3px); }
.msn-clips-comment-panel { position:absolute; left:50%; bottom:0; transform:translateX(-50%); width:min(520px,100vw); height:78svh; background:#0f172a; border-radius:20px 20px 0 0; border:1px solid rgba(255,255,255,.1); border-bottom:none; display:flex; flex-direction:column; box-shadow:0 -12px 40px rgba(0,0,0,.55); overflow:hidden; }
.msn-clips-comment-head { display:flex; align-items:center; justify-content:space-between; padding:14px 18px; border-bottom:1px solid rgba(255,255,255,.08); font-size:16px; font-weight:900; color:#fff; flex-shrink:0; }
.msn-clips-comment-close { border:none; background:rgba(255,255,255,.1); width:34px; height:34px; border-radius:50%; color:#fff; font-size:20px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background .18s; }
.msn-clips-comment-close:hover { background:rgba(255,255,255,.2); }
.msn-clips-comment-body { flex:1; overflow-y:auto; padding:12px 16px; scrollbar-width:thin; scrollbar-color:rgba(255,255,255,.12) transparent; }
.msn-clip-comment-item { display:flex; gap:10px; align-items:flex-start; padding:4px 0; }
.msn-clip-comment-item img,.msn-clip-comment-item .msn-avatar,.msn-clip-comment-item .avatar { width:36px!important; height:36px!important; border-radius:50%!important; object-fit:cover!important; flex-shrink:0!important; }
.msn-clip-comment-item > div { display:flex; flex-direction:column; gap:2px; }
.msn-clip-comment-item strong { font-size:13px; font-weight:800; color:#f1f5f9; }
.msn-clip-comment-item > div > div { font-size:14px; color:rgba(255,255,255,.75); line-height:1.4; }
.msn-clip-comment-drawer-form,.msn-clip-comment-form { display:flex; gap:8px; padding:12px 16px; background:#0f172a; border-top:1px solid rgba(255,255,255,.07); flex-shrink:0; }
.msn-clip-comment-drawer-form input,.msn-clip-comment-form input { flex:1; padding:10px 14px; border:1.5px solid rgba(255,255,255,.12); border-radius:999px; background:rgba(255,255,255,.07); color:#f1f5f9; font-size:14px; font-weight:600; outline:none; }
.msn-clip-comment-drawer-form input:focus,.msn-clip-comment-form input:focus { border-color:#1877f2; }
.msn-clip-comment-drawer-form button,.msn-clip-comment-form button { padding:10px 18px; border:none; border-radius:999px; background:#1877f2; color:#fff; font-size:14px; font-weight:800; cursor:pointer; transition:background .18s; flex-shrink:0; }
.msn-clip-comment-drawer-form button:hover,.msn-clip-comment-form button:hover { background:#0d6efd; }

/* ── More sheet ─────────────────────────────────────────────── */
.msn-clip-more-sheet { position:fixed; left:50%; bottom:0; transform:translateX(-50%) translateY(100%); width:min(420px,100vw); background:#0f172a; border-radius:20px 20px 0 0; border:1px solid rgba(255,255,255,.1); border-bottom:none; z-index:999970; padding-bottom:env(safe-area-inset-bottom,16px); box-shadow:0 -12px 40px rgba(0,0,0,.6); transition:transform .3s cubic-bezier(.4,0,.2,1); }
.msn-clip-more-sheet.is-open { transform:translateX(-50%) translateY(0); }
.msn-clip-more-sheet-handle { width:40px; height:4px; background:rgba(255,255,255,.2); border-radius:99px; margin:12px auto 6px; }
.msn-clip-more-sheet-item { display:flex; align-items:center; gap:14px; width:100%; padding:14px 20px; border:none; background:none; color:#f1f5f9; font-size:15px; font-weight:700; cursor:pointer; text-align:left; transition:background .15s; }
.msn-clip-more-sheet-item:hover { background:rgba(255,255,255,.06); }
.msn-clip-more-sheet-item.is-danger { color:#f87171; }
.msn-clip-more-sheet-backdrop { position:fixed; inset:0; z-index:999965; background:rgba(0,0,0,.4); }

/* ── Toast ──────────────────────────────────────────────────── */
.msn-clips-toast { position:fixed; bottom:28px; left:50%; transform:translateX(-50%) translateY(20px); z-index:9999999; background:rgba(15,23,42,.95); border:1px solid rgba(255,255,255,.12); border-radius:14px; padding:11px 20px; color:#fff; font-size:14px; font-weight:700; white-space:nowrap; box-shadow:0 8px 32px rgba(0,0,0,.45); opacity:0; transition:opacity .22s, transform .22s; pointer-events:none; }
.msn-clips-toast.is-visible { opacity:1; transform:translateX(-50%) translateY(0); }
.msn-clips-toast.is-success { border-color:#22c55e; }
.msn-clips-toast.is-error   { border-color:#f87171; }
.msn-clips-toast.is-info    { border-color:#60a5fa; }

.msn-muted { color:rgba(255,255,255,.4); font-size:14px; font-weight:600; padding:20px 0; text-align:center; }

/* ── Fullscreen viewer page (shortcodes) ─────────────────────── */
.msn-clips-viewer-shell { max-width:none; padding:0; }
.msn-clips-viewer-topbar { position:sticky; top:0; z-index:40; background:rgba(0,0,0,.88); backdrop-filter:blur(16px); padding:10px 18px; border-bottom:1px solid rgba(255,255,255,.07); display:flex; justify-content:space-between; align-items:center; gap:14px; flex-wrap:wrap; }
.msn-clips-viewer-title { font-size:22px; font-weight:900; color:#fff; }
.msn-clips-viewer-sub   { font-size:13px; font-weight:700; color:rgba(255,255,255,.55); margin-top:3px; }
.msn-clips-viewer-layout { display:grid; grid-template-columns:240px minmax(0,1fr); min-height:calc(100svh - 62px); }
.msn-clips-thumb-rail { position:sticky; top:62px; height:calc(100svh - 62px); overflow-y:auto; overflow-x:hidden; padding:12px 10px; background:#060810; scrollbar-width:thin; }
.msn-clips-thumb { display:grid; grid-template-columns:56px 1fr; gap:10px; align-items:center; width:100%; padding:8px; border:1.5px solid transparent; background:rgba(255,255,255,.05); border-radius:14px; color:#fff; text-align:left; cursor:pointer; margin-bottom:8px; transition:background .18s, border-color .18s; }
.msn-clips-thumb:hover     { background:rgba(255,255,255,.1); }
.msn-clips-thumb.is-active { background:rgba(24,119,242,.18); border-color:#1877f2; }
.msn-clips-thumb-image     { display:block; width:56px; height:80px; border-radius:10px; background:#111 center/cover no-repeat; }
.msn-clips-thumb-text strong,.msn-clips-thumb-text span { display:block; font-size:12px; }
.msn-clips-thumb-text strong { font-weight:800; color:#f1f5f9; }
.msn-clips-thumb-text span   { font-size:11px; color:rgba(255,255,255,.5); margin-top:3px; line-height:1.35; }
.msn-clips-vertical-feed { height:calc(100svh - 62px); overflow-y:auto; overflow-x:hidden; scroll-snap-type:y mandatory; background:#000; gap:0; scrollbar-width:none; }
.msn-clips-vertical-feed::-webkit-scrollbar { display:none; }
.msn-clips-viewer-nav { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; padding:12px; background:rgba(0,0,0,.7); }
.msn-clips-feed-switcher { display:flex; gap:4px; align-items:center; padding:8px 12px; }
.msn-clips-feed-switcher a { padding:7px 16px; border-radius:999px; background:transparent; text-decoration:none; color:rgba(255,255,255,.6); font-weight:800; font-size:14px; transition:background .18s, color .18s; }
.msn-clips-feed-switcher a.is-active,.msn-clips-feed-switcher a:hover { background:#1877f2; color:#fff; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width:900px) {
  .msn-clips-viewer-layout { grid-template-columns:1fr; }
  .msn-clips-thumb-rail { display:flex; gap:8px; height:auto; position:sticky; top:62px; padding:8px 10px; overflow-x:auto; overflow-y:hidden; white-space:nowrap; scrollbar-width:none; }
  .msn-clips-thumb-rail::-webkit-scrollbar { display:none; }
  .msn-clips-thumb { min-width:200px; margin-bottom:0; }
  .msn-clips-vertical-feed { height:auto; min-height:calc(100svh - 130px); }
  .msn-clips-screen { height:100svh; min-height:100svh; }
}
@media (max-width:640px) {
  .msn-clip-info  { right:72px; padding-bottom:20px; }
  .msn-clip-rail  { right:10px; bottom:80px; gap:14px; }
  .msn-clip-rail-icon { width:42px; height:42px; }
  .msn-clip-rail-icon svg { width:19px; height:19px; }
  .msn-clip-rail-avatar,.msn-clip-rail-avatar img,.msn-clip-rail-avatar .msn-avatar,.msn-clip-rail-avatar .avatar { width:42px!important; height:42px!important; }
  .msn-clips-comment-panel { width:100%; border-radius:16px 16px 0 0; height:82svh; }
  .msn-profile-clips-grid { gap:1px; }
  .msn-clips-grid-2,.msn-clips-grid-3,.msn-clips-grid-4 { grid-template-columns:1fr; }
}

/* ── Upload progress bar ─────────────────────────────────── */
.msn-upload-progress-wrap {
  display: none;
  margin: 12px 0 4px;
}
.msn-upload-progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  overflow: hidden;
}
.msn-upload-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1877f2, #60a5fa);
  border-radius: 999px;
  transition: width .3s ease;
}
.msn-upload-progress-pct {
  font-size: 13px;
  font-weight: 800;
  color: #60a5fa;
  text-align: right;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════
   REEL MODAL — FEED TABS  (My Clips / For You)
   ══════════════════════════════════════════════════════════ */
.msn-reel-feed-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  margin-right: 12px;
  pointer-events: all;   /* topbar is pointer-events:none, re-enable for tabs */
}
.msn-reel-tab {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,.28);
  background: transparent;
  color: rgba(255,255,255,.65);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  pointer-events: all;        /* topbar has pointer-events:none, must re-enable here */
  transition: background .18s, color .18s, border-color .18s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.msn-reel-tab:hover { background: rgba(255,255,255,.12); color: #fff; }
.msn-reel-tab.is-active {
  background: #1877f2;
  border-color: #1877f2;
  color: #fff;
}

/* make topbar flex so tabs go to right */
.msn-reel-modal-topbar {
  display: flex !important;
  align-items: center;
}

/* ══════════════════════════════════════════════════════════
   UPLOAD PROGRESS BAR
   ══════════════════════════════════════════════════════════ */
.msn-upload-progress-wrap { display:none; margin:12px 0 4px; }
.msn-upload-progress-bar-track { width:100%; height:8px; background:rgba(255,255,255,.12); border-radius:999px; overflow:hidden; }
.msn-upload-progress-bar-fill  { height:100%; width:0%; background:linear-gradient(90deg,#1877f2,#60a5fa); border-radius:999px; transition:width .3s ease; }
.msn-upload-progress-pct       { font-size:13px; font-weight:800; color:#60a5fa; text-align:right; margin-top:4px; }

/* ══════════════════════════════════════════════════════════
   SHARE SHEET  (slides up from bottom)
   ══════════════════════════════════════════════════════════ */
.msn-clip-share-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: min(480px, 100vw);
  background: #0f172a;
  border-radius: 22px 22px 0 0;
  border: 1px solid rgba(255,255,255,.1);
  border-bottom: none;
  z-index: 999975;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  box-shadow: 0 -16px 50px rgba(0,0,0,.65);
  transition: transform .32s cubic-bezier(.4,0,.2,1);
  max-height: 85svh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
.msn-clip-share-sheet.is-open { transform: translateX(-50%) translateY(0); }

.msn-share-title {
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  text-align: center;
  padding: 4px 0 14px;
}

/* ── External row (WhatsApp, Copy, More) ── */
.msn-share-external-row {
  display: flex;
  gap: 12px;
  padding: 0 18px 18px;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-wrap: wrap;
}
.msn-share-ext-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.75);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: color .18s;
  min-width: 64px;
}
.msn-share-ext-btn:hover { color: #fff; }
.msn-share-ext-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s;
}
.msn-share-ext-btn:hover .msn-share-ext-icon { transform: scale(1.08); }
.msn-share-wa   { background: #25d366; }
.msn-share-link { background: rgba(255,255,255,.15); }
.msn-share-more { background: rgba(255,255,255,.15); }
.msn-share-fb   { background: #1877f2; }

/* ── Section title ── */
.msn-share-section-title {
  font-size: 12px;
  font-weight: 900;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 14px 18px 8px;
}

/* ── Target rows (friends + groups) ── */
.msn-share-targets {
  padding: 0 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.msn-share-target-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 10px;
  border: none;
  background: none;
  color: #f1f5f9;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 12px;
  transition: background .15s;
  text-align: left;
}
.msn-share-target-btn:hover:not(:disabled) { background: rgba(255,255,255,.07); }
.msn-share-target-btn:disabled { opacity: .5; cursor: wait; }
.msn-share-target-avatar {
  width: 42px; height: 42px;
  border-radius: 50%; object-fit: cover;
  background: #1e293b; flex-shrink: 0;
}
.msn-share-group-icon {
  width: 42px; height: 42px;
  border-radius: 50%; background: rgba(24,119,242,.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.msn-share-target-sent {
  margin-left: auto;
  font-size: 13px;
  font-weight: 800;
  color: #22c55e;
}
.msn-share-loading {
  display: flex; justify-content: center; padding: 16px 0;
}
.msn-share-empty {
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,.35);
  text-align: center; padding: 12px 0;
}

/* ══════════════════════════════════════════════════════════
   POST-PAGE CLIPS STRIP
   ══════════════════════════════════════════════════════════ */
.msn-post-clips-strip {
  margin: 24px 0 8px;
  background: #0f172a;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
}
.msn-post-clips-strip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.msn-post-clips-strip-icon { font-size: 18px; }
.msn-post-clips-strip-title {
  font-size: 14px;
  font-weight: 800;
  color: #f1f5f9;
  flex: 1;
}
.msn-post-clips-see-all {
  display: flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: 1.5px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.msn-post-clips-see-all:hover { background: rgba(255,255,255,.1); color: #fff; }

.msn-post-clips-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 3px;
}
@media (max-width: 480px) {
  .msn-post-clips-thumbs { grid-template-columns: repeat(3, 1fr); }
}

/* Reuse grid-thumb styles but override size for strip */
.msn-post-clips-strip .msn-clips-grid-thumb {
  aspect-ratio: 9/16;
  border-radius: 10px;
}

/* ── "Show on post page" checkbox hint ── */
.msn-clips-privacy-row .msn-clips-hint {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
  font-weight: 500;
}

/* ══════════════════════════════════════════════════════════
   TEMPLATE COMPATIBILITY FIXES
   The Miracle template uses:
     body { overflow-x: clip }  ← creates stacking context on
     some Android browsers, which clips position:fixed elements.
     We override it only when the clips modal is open.
   ══════════════════════════════════════════════════════════ */

/* When modal is open, restore body so fixed modal is not clipped */
body.msn-modal-open {
  overflow-x: visible !important;
  overflow-y: hidden  !important;   /* prevent body scroll behind modal */
}

/* Retry button inside error state */
.msn-retry-btn {
  background: none;
  border: 1.5px solid rgba(255,255,255,.4);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  margin-left: 6px;
}
.msn-retry-btn:hover { background: rgba(255,255,255,.15); }

/* Clips empty message */
.msn-clips-empty-msg {
  color: rgba(255,255,255,.55);
  padding: 40px 20px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}
