Fix widow/play bugs, exit-anywhere; rework leaderboard + add game history

- Widow: preserve card selection across re-renders (no more deselecting)
- Play: reject a second card during trick resolution (fixes hand-count desync)
- Leave: exit available during bidding/widow/trump; a mid-game leave hands the
  seat to AI so the game continues; rooms with no humans are torn down
- Leaderboard: one-time flush + schema migration, win rate as the primary
  ranking metric, per-team shelem and per-seat bid tracking, avg score + bids won
- History: per-game round-by-round records persisted to history.json, a history
  screen, and a vertical round breakdown (with totals) shown to all players at
  hand/game end; result held for 15s

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
goyban
2026-07-05 12:29:16 +00:00
parent e0b9dde93e
commit 7c602b8e95
5 changed files with 452 additions and 41 deletions
+69
View File
@@ -760,6 +760,17 @@ input:focus { border-color: var(--gold); }
}
.overlay-box.small { max-width: 320px; }
.overlay-box h3 { font-size: 1.1rem; color: var(--gold); text-align: center; }
.overlay-leave-btn {
align-self: center;
margin-top: 4px;
background: none;
border: none;
color: rgba(255,128,128,.75);
font-size: .82rem;
cursor: pointer;
padding: 4px 8px;
}
.overlay-leave-btn:hover { color: #ff8080; text-decoration: underline; }
/* ── Bidding overlay ──────────────────────────── */
.bid-box {}
@@ -1022,6 +1033,64 @@ input:focus { border-color: var(--gold); }
.lb-table td { border-bottom: 1px solid rgba(255,255,255,.05); }
.lb-table tr:hover td { background: rgba(255,255,255,.04); }
/* ── Round-by-round breakdown ───── */
.round-breakdown-wrap { margin: 6px 0 2px; }
.rb-scroll { max-height: 42vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.round-breakdown {
border-collapse: collapse;
font-size: .82rem;
margin: 0 auto;
white-space: nowrap;
}
.round-breakdown th, .round-breakdown td {
padding: 4px 16px;
text-align: center;
}
/* Sticky team-name header so it stays visible as rounds scroll */
.round-breakdown thead th {
color: var(--muted);
font-weight: 600;
position: sticky;
top: 0;
background: #1a2e1a;
border-bottom: 1px solid rgba(255,255,255,.12);
}
.round-breakdown .rb-round {
text-align: left;
color: var(--muted);
font-weight: 600;
}
.round-breakdown td.pos { color: #69f0ae; }
.round-breakdown td.neg { color: #ff6b6b; }
/* Horizontal line before the final totals row */
.round-breakdown .rb-final td {
border-top: 2px solid var(--gold);
font-weight: 700;
color: var(--gold);
}
.round-breakdown .rb-final .rb-round { color: var(--gold); }
/* ── Game history list ───── */
.history-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.history-item {
display: flex;
flex-direction: column;
gap: 4px;
padding: 10px 12px;
border-radius: 10px;
background: rgba(255,255,255,.04);
border: 1px solid rgba(255,255,255,.08);
border-left: 4px solid rgba(255,255,255,.15);
cursor: pointer;
}
.history-item:hover { background: rgba(255,255,255,.07); }
.history-item.won { border-left-color: #69f0ae; }
.history-item.lost { border-left-color: #ff6b6b; }
.history-item-main { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.history-item-result { font-weight: 700; }
.history-item-teams { font-size: .82rem; color: rgba(255,255,255,.75); text-align: right; }
.history-item-meta { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); }
/* ── Waiting room top row (Leave + ☰ menu) ───── */
.waiting-top-row {
display: flex;