import type { ConnectionStatus } from '@/lib/game';
import { cn } from '@/lib/cn';
import s from '../tv.module.css';

/** Full-stage overlay while the host has paused the event. */
export function PausedOverlay() {
  return (
    <div role="status" className="glass absolute inset-0 z-40 grid place-items-center">
      <div className={cn('flex flex-col items-center gap-[36px] text-center', s.lockBeat)}>
        <span aria-hidden="true" className="flex size-[200px] items-center justify-center gap-[28px] rounded-full border-4 border-amber/70 bg-amber/10 shadow-glow-amber">
          <span className="h-[84px] w-[26px] rounded-[8px] bg-amber" />
          <span className="h-[84px] w-[26px] rounded-[8px] bg-amber" />
        </span>
        <h2 className="font-display text-[104px] leading-none font-extrabold tracking-[-0.03em]">Paused by the host</h2>
        <p className="text-[38px] text-muted">Hang tight: the game picks up right where it left off.</p>
      </div>
    </div>
  );
}

/** Subtle corner pill while the socket is down; the TV keeps showing the last known state. */
export function ConnectionPill({ status }: { status: ConnectionStatus }) {
  if (status !== 'reconnecting' && status !== 'offline') return null;
  return (
    <div role="status" className="absolute bottom-[28px] left-[28px] z-50 flex items-center gap-[12px] rounded-full border border-amber/50 bg-night/90 py-[10px] pr-[22px] pl-[16px] shadow-card">
      <span aria-hidden="true" className={cn('size-[14px] rounded-full bg-amber', s.dotPulse)} />
      <span className="text-[22px] font-semibold text-amber-soft">{status === 'offline' ? 'Connection lost · retrying' : 'Reconnecting…'}</span>
    </div>
  );
}
