// video-player.jsx — Full-page video player + Reddit-style Comments sheet.
//
// Used for the "Watch post-game presser" quest and any other tap-to-play
// video card (Continue Watching, For You, Headlines).
//
// Props:
//   video:   { title, episode, coach, sub, duration, views, drop, poster, comments }
//            (typically the active tenant's `PRESSER` config)
//   onClose: () => void  — fired when the user dismisses the player.
//                          App-level wiring fires +50 pts on close.

const RW_AVATARS_VP = Array.from({ length: 10 }).map((_, i) =>
  `mountaineer/assets/rewards/avatar-${String(i + 1).padStart(2, '0')}.png`);

// ─────────────────────────────────────────────────────────────────────
// FullScreenVideoPlayer
// ─────────────────────────────────────────────────────────────────────
function FullScreenVideoPlayer({ video, onClose }) {
  const v = video || {};
  const duration = v.duration || '22:14';
  // Parse duration "MM:SS" into total seconds
  const totalSec = React.useMemo(() => {
    const [m, s] = String(duration).split(':').map(n => parseInt(n, 10) || 0);
    return m * 60 + s;
  }, [duration]);

  const [playing, setPlaying] = React.useState(true);
  const [muted, setMuted]     = React.useState(false);
  const [elapsed, setElapsed] = React.useState(0); // seconds
  const [showComments, setShowComments] = React.useState(false);
  const [showChrome, setShowChrome] = React.useState(true);

  // Auto-open the comments sheet 1s after the player mounts so the discussion
  // is the first thing people see. (Prototype — demonstrates the chat feature.)
  React.useEffect(() => {
    const t = setTimeout(() => setShowComments(true), 1000);
    return () => clearTimeout(t);
  }, []);

  // "Playback" advances the scrubber while playing
  React.useEffect(() => {
    if (!playing) return;
    const iv = setInterval(() => {
      setElapsed(e => {
        const next = e + 1;
        // Loop back when we hit the end so the prototype keeps running
        return next >= totalSec ? 0 : next;
      });
    }, 1000);
    return () => clearInterval(iv);
  }, [playing, totalSec]);

  // Auto-hide chrome after 3s of inactivity for a cinematic feel
  React.useEffect(() => {
    if (!showChrome) return;
    const t = setTimeout(() => setShowChrome(false), 3500);
    return () => clearTimeout(t);
  }, [showChrome, elapsed]);

  const tapVideo = () => setShowChrome(s => !s);
  const fmt = (sec) => {
    const m = Math.floor(sec / 60);
    const s = sec % 60;
    return `${m}:${String(s).padStart(2, '0')}`;
  };
  const pct = totalSec ? (elapsed / totalSec) * 100 : 0;

  const [posterOk, setPosterOk] = React.useState(true);

  return (
    <div style={{
      position: 'absolute', inset: 0, zIndex: 250,
      background: '#000',
      overflow: 'hidden',
    }}>
      {/* ─── Poster image (the "video frame") ─── */}
      <div onClick={tapVideo} style={{
        position: 'absolute', inset: 0,
        cursor: 'pointer',
      }}>
        {posterOk && v.poster ? (
          <img
            src={v.poster}
            alt={v.title || 'Video'}
            onError={() => setPosterOk(false)}
            style={{
              position: 'absolute', inset: 0,
              width: '100%', height: '100%',
              objectFit: 'cover',
              objectPosition: 'center 30%',
              // Subtle Ken Burns zoom while playing
              animation: playing ? 'mtnKenBurns 28s ease-out infinite alternate' : 'none',
            }}
          />
        ) : (
          <div style={{
            position: 'absolute', inset: 0,
            background: `
              radial-gradient(ellipse 70% 50% at 50% 30%, ${hexA(WVU.gold, 0.25)}, transparent 60%),
              linear-gradient(180deg, ${WVU.ink2}, #000)
            `,
            display: 'flex', alignItems: 'center', justifyContent: 'center',
          }}>
            <div style={{
              width: 220, height: 220, borderRadius: '50%',
              background: `linear-gradient(145deg, ${WVU.gold}, ${WVU.goldDim})`,
              display: 'flex', alignItems: 'center', justifyContent: 'center',
              fontFamily: DS.display, fontSize: 80, fontWeight: 900,
              color: WVU.blueDim, letterSpacing: '-0.04em',
              boxShadow: `0 24px 60px ${hexA(WVU.gold, 0.5)}`,
            }}>📹</div>
          </div>
        )}
        {/* Dim overlay so chrome is legible */}
        <div style={{
          position: 'absolute', inset: 0,
          background: `
            linear-gradient(180deg, rgba(0,0,0,0.55) 0%, transparent 22%, transparent 60%, rgba(0,0,0,0.7) 100%)
          `,
          pointerEvents: 'none',
          opacity: showChrome ? 1 : 0.5,
          transition: 'opacity 220ms ease',
        }} />
      </div>

      {/* Ken Burns keyframes */}
      <style>{`
        @keyframes mtnKenBurns {
          from { transform: scale(1) translate(0, 0); }
          to   { transform: scale(1.08) translate(-2%, -1.5%); }
        }
        @keyframes mtnSheetUp {
          from { transform: translateY(110%); }
          to   { transform: translateY(0); }
        }
      `}</style>

      {/* ─── Top chrome: close + title + ⋯ ─── */}
      <div style={{
        position: 'absolute', top: 0, left: 0, right: 0, zIndex: 5,
        padding: '54px 14px 16px',
        background: 'linear-gradient(180deg, rgba(0,0,0,0.55), transparent)',
        display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12,
        opacity: showChrome ? 1 : 0,
        transform: showChrome ? 'translateY(0)' : 'translateY(-8px)',
        transition: 'opacity 240ms ease, transform 240ms ease',
        pointerEvents: showChrome ? 'auto' : 'none',
      }}>
        <button onClick={onClose} style={{
          width: 38, height: 38, borderRadius: 19,
          background: 'rgba(0,0,0,0.55)', backdropFilter: 'blur(10px)',
          border: '0.5px solid rgba(255,255,255,0.18)',
          color: '#fff', cursor: 'pointer', padding: 0,
          display: 'flex', alignItems: 'center', justifyContent: 'center',
          flexShrink: 0,
        }}>
          <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
            <path d="M2 2l10 10M12 2L2 12" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round"/>
          </svg>
        </button>
        <div style={{ flex: 1, minWidth: 0, textAlign: 'center' }}>
          <div style={{
            fontFamily: DS.sans, fontSize: 11, fontWeight: 700,
            color: WVU.gold, letterSpacing: '0.14em', textTransform: 'uppercase',
            textShadow: '0 1px 4px rgba(0,0,0,0.6)',
          }}>{v.episode || 'Ep. 12'}</div>
          <div style={{
            fontFamily: DS.sans, fontSize: 14, fontWeight: 700,
            color: '#fff', letterSpacing: '-0.005em',
            textShadow: '0 1px 4px rgba(0,0,0,0.6)',
            marginTop: 2,
            overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
          }}>{v.title || 'Post-Game Presser'}</div>
        </div>
        <button style={{
          width: 38, height: 38, borderRadius: 19,
          background: 'rgba(0,0,0,0.55)', backdropFilter: 'blur(10px)',
          border: '0.5px solid rgba(255,255,255,0.18)',
          color: '#fff', cursor: 'pointer', padding: 0,
          display: 'flex', alignItems: 'center', justifyContent: 'center',
          flexShrink: 0,
        }}>
          <svg width="18" height="4" viewBox="0 0 18 4" fill="currentColor">
            <circle cx="2" cy="2" r="1.6"/><circle cx="9" cy="2" r="1.6"/><circle cx="16" cy="2" r="1.6"/>
          </svg>
        </button>
      </div>

      {/* ─── Center play/pause overlay ─── */}
      {showChrome && (
        <button onClick={(e) => { e.stopPropagation(); setPlaying(p => !p); setShowChrome(true); }} style={{
          position: 'absolute', top: '50%', left: '50%',
          transform: 'translate(-50%, -50%)',
          width: 72, height: 72, borderRadius: 36,
          background: 'rgba(0,0,0,0.55)', backdropFilter: 'blur(10px)',
          border: '0.5px solid rgba(255,255,255,0.2)',
          color: '#fff', cursor: 'pointer', padding: 0,
          display: 'flex', alignItems: 'center', justifyContent: 'center',
          zIndex: 5,
          boxShadow: '0 8px 24px rgba(0,0,0,0.45)',
        }}>
          {playing ? (
            <svg width="22" height="26" viewBox="0 0 22 26"><rect x="3" y="2" width="6" height="22" rx="1.5" fill="currentColor"/><rect x="13" y="2" width="6" height="22" rx="1.5" fill="currentColor"/></svg>
          ) : (
            <svg width="24" height="28" viewBox="0 0 24 28"><path d="M4 2v24l18-12L4 2z" fill="currentColor"/></svg>
          )}
        </button>
      )}

      {/* ─── Bottom chrome: scrubber + controls + episode meta ─── */}
      <div style={{
        position: 'absolute', left: 0, right: 0, bottom: 0, zIndex: 5,
        padding: '20px 18px 38px',
        background: 'linear-gradient(180deg, transparent, rgba(0,0,0,0.85))',
        opacity: showChrome ? 1 : 0,
        transform: showChrome ? 'translateY(0)' : 'translateY(12px)',
        transition: 'opacity 240ms ease, transform 240ms ease',
        pointerEvents: showChrome ? 'auto' : 'none',
      }}>
        {/* Episode meta */}
        <div style={{ marginBottom: 14 }}>
          <div style={{
            fontFamily: DS.sans, fontSize: 18, fontWeight: 800,
            color: '#fff', letterSpacing: '-0.015em', lineHeight: 1.15,
            textShadow: '0 1px 6px rgba(0,0,0,0.7)',
          }}>{v.sub || 'After the K-State win · 22 min'}</div>
          <div style={{
            fontFamily: DS.mono, fontSize: 10, fontWeight: 500,
            color: 'rgba(255,255,255,0.7)', letterSpacing: '0.08em',
            marginTop: 4, textTransform: 'uppercase',
          }}>{v.views || '14.2K views'} · {v.drop || '2 hours ago'}</div>
        </div>

        {/* Scrubber */}
        <div style={{
          height: 4, borderRadius: 2,
          background: 'rgba(255,255,255,0.22)',
          position: 'relative', marginBottom: 8,
          cursor: 'pointer',
        }} onClick={(e) => {
          // Seek visually based on click position
          const rect = e.currentTarget.getBoundingClientRect();
          const ratio = (e.clientX - rect.left) / rect.width;
          setElapsed(Math.round(ratio * totalSec));
        }}>
          <div style={{
            position: 'absolute', left: 0, top: 0, bottom: 0,
            width: `${pct}%`, borderRadius: 2,
            background: `linear-gradient(90deg, ${WVU.goldDim}, ${WVU.gold})`,
            boxShadow: 'none',
          }} />
          <div style={{
            position: 'absolute', left: `${pct}%`, top: '50%',
            transform: 'translate(-50%, -50%)',
            width: 12, height: 12, borderRadius: 6,
            background: WVU.gold,
            boxShadow: `0 2px 6px rgba(0,0,0,0.5)`,
          }} />
        </div>
        <div style={{
          display: 'flex', justifyContent: 'space-between',
          fontFamily: DS.mono, fontSize: 11, fontWeight: 600,
          color: 'rgba(255,255,255,0.85)', letterSpacing: '0.04em',
          marginBottom: 14,
          fontVariantNumeric: 'tabular-nums',
        }}>
          <span>{fmt(elapsed)}</span>
          <span>-{fmt(Math.max(0, totalSec - elapsed))}</span>
        </div>

        {/* Control row */}
        <div style={{
          display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8,
        }}>
          <button onClick={(e) => { e.stopPropagation(); setPlaying(p => !p); setShowChrome(true); }} style={{
            ...iconBtn(playing),
          }}>
            {playing ? (
              <svg width="14" height="16" viewBox="0 0 14 16"><rect x="1" y="1" width="4" height="14" rx="1" fill="currentColor"/><rect x="9" y="1" width="4" height="14" rx="1" fill="currentColor"/></svg>
            ) : (
              <svg width="14" height="16" viewBox="0 0 14 16"><path d="M2 1v14l11-7L2 1z" fill="currentColor"/></svg>
            )}
          </button>
          <button onClick={(e) => { e.stopPropagation(); setMuted(m => !m); }} style={iconBtn(false)}>
            {muted ? (
              <svg width="18" height="14" viewBox="0 0 18 14" fill="none"><path d="M2 5h2l4-3v10L4 9H2V5z" fill="currentColor"/><path d="M12 5l4 4M16 5l-4 4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round"/></svg>
            ) : (
              <svg width="18" height="14" viewBox="0 0 18 14" fill="none"><path d="M2 5h2l4-3v10L4 9H2V5z" fill="currentColor"/><path d="M12 4q2 3 0 6M14 2q4 5 0 10" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" fill="none"/></svg>
            )}
          </button>
          <button data-pulse="true" onClick={(e) => { e.stopPropagation(); setShowComments(true); }} style={{
            ...iconBtn(false),
            paddingLeft: 12, paddingRight: 12,
            width: 'auto', gap: 6,
            '--hint-color': hexA(WVU.gold, 0.55),
            '--hint-color-soft': hexA(WVU.gold, 0.22),
          }}>
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M2 3h12v8H7l-3 2v-2H2V3z" stroke="currentColor" strokeWidth="1.5" strokeLinejoin="round" fill="none"/>
            </svg>
            <span style={{ fontFamily: DS.mono, fontSize: 11, fontWeight: 700, letterSpacing: '0.04em' }}>
              {(v.comments || []).length}
            </span>
          </button>
          <button style={iconBtn(false)}>
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M3 2l2-1h6l2 1v5l-2 1H5L3 7V2z" stroke="currentColor" strokeWidth="1.4" strokeLinejoin="round" fill="none"/>
              <path d="M5 8l3 4 3-4" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" fill="none"/>
            </svg>
          </button>
          <button style={iconBtn(false)}>
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M1 5V1h4M11 1h4v4M15 11v4h-4M5 15H1v-4" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" fill="none"/>
            </svg>
          </button>
        </div>
      </div>

      {/* ─── Comments bottom sheet ─── */}
      {showComments && (
        <CommentsSheet
          comments={v.comments || []}
          videoTitle={v.title}
          onClose={() => setShowComments(false)}
        />
      )}
    </div>
  );
}

const iconBtnStyle = (active) => ({
  width: 38, height: 38, borderRadius: 19,
  background: active ? 'rgba(234,170,0,0.18)' : 'rgba(255,255,255,0.10)',
  border: `0.5px solid ${active ? 'rgba(234,170,0,0.5)' : 'rgba(255,255,255,0.16)'}`,
  color: '#fff', cursor: 'pointer', padding: 0,
  display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
  flexShrink: 0,
});
const iconBtn = iconBtnStyle;

// ─────────────────────────────────────────────────────────────────────
// CommentsSheet — Reddit/Threads-style bottom sheet
// ─────────────────────────────────────────────────────────────────────
function CommentsSheet({ comments = [], videoTitle, onClose }) {
  const [sort, setSort] = React.useState('top'); // 'top' | 'new'
  const [votes, setVotes] = React.useState({}); // { id: 'up' | 'down' | null }
  const [expanded, setExpanded] = React.useState({}); // { id: true } for "Read more"

  // Apply sort
  const sorted = React.useMemo(() => {
    const arr = comments.slice();
    if (sort === 'top') {
      arr.sort((a, b) => {
        const av = (a.votes || 0) + adjustment(votes[a.id]);
        const bv = (b.votes || 0) + adjustment(votes[b.id]);
        return bv - av;
      });
    } else {
      // 'new' — assume input order is roughly newest at bottom for 't' strings
      // Reverse so "1m ago" surfaces first
      arr.reverse();
    }
    return arr;
  }, [comments, sort, votes]);

  function adjustment(v) {
    if (v === 'up') return 1;
    if (v === 'down') return -1;
    return 0;
  }
  const toggleVote = (id, direction) => {
    setVotes(prev => ({ ...prev, [id]: prev[id] === direction ? null : direction }));
  };

  return (
    <div onClick={onClose} style={{
      position: 'absolute', inset: 0, zIndex: 10,
      background: 'rgba(0,0,0,0.55)',
      display: 'flex', alignItems: 'flex-end',
      animation: 'mtnFade 220ms ease-out',
    }}>
      <div onClick={(e) => e.stopPropagation()} style={{
        width: '100%', height: '74%',
        background: '#15151B', color: '#fff',
        borderTopLeftRadius: 22, borderTopRightRadius: 22,
        boxShadow: '0 -12px 40px rgba(0,0,0,0.6)',
        animation: 'mtnSheetUp 320ms cubic-bezier(0.22, 1, 0.36, 1)',
        display: 'flex', flexDirection: 'column',
        overflow: 'hidden',
      }}>
        {/* Drag handle */}
        <div style={{ display: 'flex', justifyContent: 'center', padding: '8px 0 4px' }}>
          <div style={{ width: 36, height: 4, borderRadius: 2, background: 'rgba(255,255,255,0.25)' }} />
        </div>

        {/* Header */}
        <div style={{
          display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 10,
          padding: '8px 18px 14px',
        }}>
          <div style={{
            fontFamily: DS.display, fontSize: 22, fontWeight: 800,
            color: '#fff', letterSpacing: '-0.015em', lineHeight: 1,
          }}>Comments</div>
          <div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
            {/* Sort pills */}
            <button onClick={() => setSort('top')} style={pillStyle(sort === 'top')}>Top</button>
            <button onClick={() => setSort('new')} style={pillStyle(sort === 'new')}>Newest</button>
            <button onClick={onClose} style={{
              width: 30, height: 30, borderRadius: 15,
              background: 'rgba(255,255,255,0.10)',
              border: '0.5px solid rgba(255,255,255,0.15)',
              color: '#fff', cursor: 'pointer', padding: 0,
              display: 'flex', alignItems: 'center', justifyContent: 'center',
              marginLeft: 4,
            }}>
              <svg width="11" height="11" viewBox="0 0 12 12"><path d="M2 2l8 8M10 2l-8 8" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round"/></svg>
            </button>
          </div>
        </div>

        {/* Comments list (scrollable) */}
        <div style={{ flex: 1, overflow: 'auto', padding: '4px 18px 12px' }} className="mtn-scrollbar">
          {sorted.map((c, idx) => {
            const myVote = votes[c.id] || null;
            const voteCount = (c.votes || 0) + adjustment(myVote);
            const showFull = expanded[c.id] || !c.truncate;
            const body = showFull ? c.body : (c.body.length > 90 ? c.body.slice(0, 88) : c.body);
            const avatarUrl = RW_AVATARS_VP[(c.avatarIdx ?? idx) % 10];
            return (
              <div key={c.id} style={{
                padding: '14px 0',
                borderBottom: idx === sorted.length - 1 ? 'none' : '0.5px solid rgba(255,255,255,0.08)',
                display: 'flex', gap: 12,
              }}>
                {/* Avatar with brand-ring */}
                <div style={{
                  width: 36, height: 36, borderRadius: 18, flexShrink: 0,
                  background: '#0a0805', overflow: 'hidden',
                  border: `2px solid ${WVU.gold}`,
                  boxShadow: `0`,
                }}>
                  <img src={avatarUrl} alt="" style={{ width: '100%', height: '100%', objectFit: 'cover' }} />
                </div>
                <div style={{ flex: 1, minWidth: 0 }}>
                  {/* handle + timestamp + unread dot + ⋯ */}
                  <div style={{
                    display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8,
                  }}>
                    <div style={{ display: 'flex', alignItems: 'center', gap: 6, minWidth: 0, flex: 1 }}>
                      <span style={{
                        fontFamily: DS.sans, fontSize: 13, fontWeight: 700,
                        color: 'rgba(255,255,255,0.92)', letterSpacing: '-0.005em',
                        whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis',
                      }}>{c.h}</span>
                      <span style={{
                        fontFamily: DS.sans, fontSize: 12,
                        color: 'rgba(255,255,255,0.45)',
                      }}>· {c.t}</span>
                      {c.unread && (
                        <span style={{
                          width: 6, height: 6, borderRadius: 3,
                          background: '#FF3344', flexShrink: 0,
                          boxShadow: '0',
                        }} />
                      )}
                    </div>
                    <button style={{
                      width: 24, height: 24, padding: 0, border: 'none',
                      background: 'transparent', color: 'rgba(255,255,255,0.45)',
                      cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center',
                    }}>
                      <svg width="16" height="4" viewBox="0 0 16 4"><circle cx="2" cy="2" r="1.4" fill="currentColor"/><circle cx="8" cy="2" r="1.4" fill="currentColor"/><circle cx="14" cy="2" r="1.4" fill="currentColor"/></svg>
                    </button>
                  </div>
                  {/* Body */}
                  <div style={{
                    fontFamily: DS.sans, fontSize: 14, fontWeight: 500,
                    color: '#fff', letterSpacing: '-0.005em', lineHeight: 1.4,
                    marginTop: 4,
                  }}>
                    {body}
                    {c.truncate && !showFull && (
                      <>
                        <span style={{ color: 'rgba(255,255,255,0.5)' }}>… </span>
                        <span
                          onClick={() => setExpanded(e => ({ ...e, [c.id]: true }))}
                          style={{
                            color: 'rgba(255,255,255,0.5)',
                            cursor: 'pointer', fontWeight: 600,
                          }}
                        >Read more</span>
                      </>
                    )}
                  </div>
                  {/* Action row: up / count / down / reply */}
                  <div style={{ display: 'flex', alignItems: 'center', gap: 16, marginTop: 8 }}>
                    <button onClick={() => toggleVote(c.id, 'up')} style={voteBtnStyle(myVote === 'up')}>
                      <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                        <path d="M7 2l5 5h-3v5H5V7H2l5-5z" fill={myVote === 'up' ? WVU.gold : 'currentColor'}/>
                      </svg>
                    </button>
                    <span style={{
                      fontFamily: DS.mono, fontSize: 13, fontWeight: 700,
                      color: 'rgba(255,255,255,0.85)',
                      fontVariantNumeric: 'tabular-nums',
                      minWidth: 32,
                    }}>{voteCount.toLocaleString()}</span>
                    <button onClick={() => toggleVote(c.id, 'down')} style={voteBtnStyle(myVote === 'down')}>
                      <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                        <path d="M7 12L2 7h3V2h4v5h3l-5 5z" fill={myVote === 'down' ? '#5E7CE2' : 'currentColor'}/>
                      </svg>
                    </button>
                    <button style={{
                      ...voteBtnStyle(false),
                      paddingLeft: 8, paddingRight: 10, gap: 4,
                      width: 'auto',
                    }}>
                      <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
                        <path d="M2 3h10v6H6l-2 2v-2H2V3z" stroke="currentColor" strokeWidth="1.3" strokeLinejoin="round" fill="none"/>
                      </svg>
                      {c.replies > 0 && (
                        <span style={{
                          fontFamily: DS.mono, fontSize: 11, fontWeight: 600,
                          color: 'rgba(255,255,255,0.7)',
                        }}>{c.replies}</span>
                      )}
                    </button>
                  </div>
                </div>
              </div>
            );
          })}
        </div>

        {/* Compose row */}
        <div style={{
          padding: '12px 18px 18px',
          borderTop: '0.5px solid rgba(255,255,255,0.08)',
          background: '#0F0F14',
          display: 'flex', alignItems: 'center', gap: 10,
        }}>
          <div style={{
            width: 36, height: 36, borderRadius: 18, flexShrink: 0,
            border: `2px solid ${WVU.gold}`, overflow: 'hidden',
            background: '#0a0805',
          }}>
            <img src={RW_AVATARS_VP[9]} alt="" style={{ width: '100%', height: '100%', objectFit: 'cover' }} />
          </div>
          <div style={{
            flex: 1, padding: '10px 14px',
            background: 'rgba(255,255,255,0.06)',
            border: '0.5px solid rgba(255,255,255,0.10)',
            borderRadius: 999,
            fontFamily: DS.sans, fontSize: 14,
            color: 'rgba(255,255,255,0.55)',
          }}>Add a comment…</div>
          <button style={{
            width: 38, height: 38, borderRadius: 19,
            background: 'rgba(255,255,255,0.08)',
            border: '0.5px solid rgba(255,255,255,0.10)',
            color: 'rgba(255,255,255,0.7)',
            cursor: 'pointer', padding: 0,
            display: 'flex', alignItems: 'center', justifyContent: 'center',
            flexShrink: 0,
          }}>
            <svg width="18" height="18" viewBox="0 0 18 18" fill="none">
              <path d="M2 9l14-7-5 16-2-7-7-2z" stroke="currentColor" strokeWidth="1.6" strokeLinejoin="round" fill="none"/>
            </svg>
          </button>
        </div>
      </div>
    </div>
  );
}

function pillStyle(active) {
  return {
    padding: '7px 14px', borderRadius: 999,
    background: active ? '#E5202C' : 'rgba(255,255,255,0.10)',
    border: 'none',
    color: '#fff',
    fontFamily: DS.sans, fontSize: 13, fontWeight: 700,
    letterSpacing: '-0.005em',
    cursor: 'pointer',
  };
}

function voteBtnStyle(active) {
  return {
    minWidth: 28, height: 28, padding: '0 4px',
    background: active ? 'rgba(234,170,0,0.12)' : 'transparent',
    border: 'none',
    color: active ? WVU.gold : 'rgba(255,255,255,0.55)',
    cursor: 'pointer',
    display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
    borderRadius: 6,
  };
}

Object.assign(window, { FullScreenVideoPlayer, CommentsSheet });
