# Shark Game — Scoring Events & Push Notification Architecture

## Point Values
- Sighting: +2 pts
- Bite: +5 pts
- Fatality: +10 pts

## Push Notification Lifecycle
1. Scraper runs hourly (cron: `shark-scraper.sh`)
2. Found events are scored in the backend
3. `send_push_notification()` is called for each affected region
4. Backend checks user's quiet hours and notification type preferences
5. If notification is allowed, `webpush()` sends via VAPID keys through pywebpush
6. Apple Push Service (APNs) delivers to iOS PWA, or browser push on desktop

## Per-User Quiet Hours (default: 9 PM - 6 AM ET)
```sql
ALTER TABLE users ADD COLUMN quiet_hours_start TEXT DEFAULT '21:00';
ALTER TABLE users ADD COLUMN quiet_hours_end TEXT DEFAULT '06:00';
ALTER TABLE users ADD COLUMN notify_sightings INTEGER DEFAULT 1;
ALTER TABLE users ADD COLUMN notify_bites INTEGER DEFAULT 1;
ALTER TABLE users ADD COLUMN notify_fatalities INTEGER DEFAULT 1;
ALTER TABLE users ADD COLUMN notify_draft INTEGER DEFAULT 1;
ALTER TABLE users ADD COLUMN quiet_hours_enabled INTEGER DEFAULT 1;
```

## Draft Reminder Emails
Cron job `shark-draft-reminder` runs every 15 minutes, checks leagues with upcoming drafts.

Two reminders per player per league:
- 24h before draft: "Your draft starts in 24 hours!"
- 1h before draft: "Your draft starts in 1 hour!"

**Tracking file:** `/root/shark-game/data/draft-reminders.json` — prevents duplicates.

**Email:** Same pattern as boys-mail-monitor (shonuff@g, mail.germainebrown.com:2525, BCC g@germainebrown.com, random Sho'Nuff signature).

## Desktop Layout
The game is mobile-first but scales for desktop:
- Max width: 1400px centered
- Multi-column layout at 1024px+
- Map + leaderboard side by side on widescreen
- Mobile layout unchanged on small screens

## Settings Page
At `/settings.html` with:
- Notification toggles (sightings, bites, fatalities, draft)
- Quiet hours (start time, end time, enable toggle)
- Profile info (display name, email)
- League info

## Help Page
At `/help.html` with:
- PWA setup guide (iOS steps, Android steps)
- Push notification enablement guide
- Quiet hours explanation
- Scoring reference
- Troubleshooting checklist
