Files
tavolo/web/style.css
T
woggioni 7bb6b74fdc
CI / Build and push docker image (push) Successful in 1m45s
Add briscola: classic two-player and briscola a quattro
New tavolo-briscola distribution implementing briscola on the platform:

- pure rules (state.py, engine.py): 3-card deals, a face-up trump that
  is the last card drawn, trump-first trick resolution (A > 3 > K > H >
  J > 7 > 6 > 5 > 4 > 2), 120 points per deal, 60-60 patta re-deals, a
  configurable target score (default 61), deal-end acknowledgements and
  turn auto-play;
- BriscolaEngine (briscola, 2 players) and BriscolaQuattroEngine
  (briscola_a_quattro, 4 players in fixed partnerships) adapters;
- registered in tavolo-app, packaged in the Docker image, documented.

Platform fixes surfaced by a two-player lobby:

- the websocket state and snapshot payloads now carry seats_open (they
  were only in the REST lobby payload), so lobbies with player counts
  other than four render correctly; seats_open is clamped at zero;
- the web client logs unparseable server messages instead of silently
  dropping them.

Web client: briscola table for both variants (stock, face-up trump,
trick, last-trick banner), deal summary modal and game-over overlay.

Tests: tavolo-briscola rules/adapter suites, app integration tests
(lobby, websocket play, turn timeout, deal-end acks, persistence), a
platform seats_open test and frontend model parsing tests.
2026-10-06 14:08:25 +08:00

543 lines
9.0 KiB
CSS

/* tavolo frontend — game tables, cards and scoring summaries.
*
* The felt palette and the Bootstrap theme overrides live in theme.css,
* which is loaded before this file. */
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: "Segoe UI", system-ui, sans-serif;
}
.app {
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* ---------- shared chrome ---------- */
.app-toast {
position: fixed;
top: 1rem;
left: 50%;
transform: translateX(-50%);
background: var(--danger);
color: #fff;
padding: 0.6rem 1.2rem;
border-radius: 8px;
z-index: 30;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
/* ---------- game table ---------- */
.hud {
display: flex;
gap: 1.5rem;
align-items: center;
justify-content: center;
padding: 0.6rem 1rem;
background: rgba(0, 0, 0, 0.3);
}
.hud a {
color: var(--accent);
text-decoration: none;
}
.hud-scores {
font-weight: 600;
}
.turn-note {
color: var(--muted);
}
.turn-note.you {
color: var(--accent);
font-weight: 700;
}
.turn-timer {
color: var(--muted);
font-variant-numeric: tabular-nums;
}
.table-wrap {
display: flex;
flex-direction: column;
flex: 1;
}
.table-grid {
flex: 1;
display: grid;
grid-template-columns: 1fr 2.4fr 1fr;
grid-template-rows: auto 1fr auto;
grid-template-areas:
". top ."
"left center right"
"bottom bottom bottom";
gap: 0.5rem;
padding: 0.75rem;
}
.seat-top {
grid-area: top;
}
.seat-left {
grid-area: left;
}
.seat-right {
grid-area: right;
}
.seat-bottom {
grid-area: bottom;
text-align: center;
}
.seat {
background: var(--panel);
border: 2px solid transparent;
border-radius: 10px;
padding: 0.5rem 0.75rem;
text-align: center;
/* Fixed height keeps the table from jumping as cards are played. */
display: flex;
flex-direction: column;
justify-content: flex-start;
min-height: 116px;
align-self: center;
width: 100%;
}
.seat.active {
border-color: var(--accent);
box-shadow: 0 0 12px rgba(232, 197, 71, 0.45);
}
.seat-name {
font-weight: 600;
display: flex;
gap: 0.5rem;
align-items: center;
justify-content: center;
}
.team-badge {
font-size: 0.7rem;
background: var(--panel-light);
border-radius: 4px;
padding: 0.1rem 0.35rem;
color: var(--muted);
}
/* Opponents' hidden hands: a tidy grid so the count reads at a glance. */
.seat-cards {
display: grid;
grid-template-columns: repeat(5, auto);
gap: 2px;
justify-content: center;
margin: 0.35rem 0;
}
.seat-stats {
font-size: 0.8rem;
color: var(--muted);
margin-top: auto;
}
/* The viewer's own stats sit above the hand; no flex context here. */
.seat-bottom .seat-stats {
margin-bottom: 0.35rem;
}
.center {
grid-area: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.75rem;
min-height: 230px;
}
.table-cards {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
justify-content: center;
min-height: 90px;
align-items: center;
}
.table-empty {
color: var(--muted);
font-style: italic;
}
/* ---------- cards ---------- */
.playing-card {
border-radius: 6px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
background: #fff;
user-select: none;
}
.playing-card.mini {
height: 34px;
}
.playing-card.move-card {
height: 54px;
vertical-align: middle;
}
.playing-card.table-card {
height: 84px;
}
.playing-card.hand-card {
height: 120px;
}
.hand {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
justify-content: center;
align-items: flex-end;
min-height: 132px;
}
.hand-slot {
background: none;
border: none;
padding: 0;
cursor: pointer;
transition: transform 0.1s ease;
}
.hand-slot:hover {
transform: translateY(-8px);
}
.hand-slot.selected {
outline: 3px solid var(--accent);
border-radius: 8px;
transform: translateY(-10px);
}
/* ---------- move banner ---------- */
.move-banner {
display: flex;
align-items: center;
gap: 0.4rem;
background: rgba(0, 0, 0, 0.35);
border-radius: 999px;
padding: 0.35rem 1rem;
font-size: 0.95rem;
}
.scopa-badge {
background: var(--accent);
color: #1d1d1d;
font-weight: 700;
border-radius: 999px;
padding: 0.15rem 0.6rem;
margin-left: 0.25rem;
}
.pigliatutto-badge {
background: var(--danger, #d9534f);
color: #fff;
font-weight: 700;
border-radius: 999px;
padding: 0.15rem 0.6rem;
margin-left: 0.25rem;
}
.spectator-badge {
background: var(--panel-light);
color: var(--muted);
font-weight: 700;
border-radius: 999px;
padding: 0.15rem 0.6rem;
border: 1px solid var(--muted);
}
/* ---------- overlays ---------- */
.overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.65);
display: flex;
align-items: center;
justify-content: center;
z-index: 20;
}
.picker {
background: var(--panel);
border-radius: 14px;
padding: 1.5rem 2rem;
text-align: center;
min-width: 320px;
}
.capture-options {
display: flex;
flex-direction: column;
gap: 0.5rem;
margin: 1rem 0;
}
.capture-option {
background: var(--panel-light);
border: 1px solid #4c6a54;
border-radius: 10px;
padding: 0.4rem;
cursor: pointer;
display: flex;
gap: 0.4rem;
justify-content: center;
}
.capture-option:hover {
border-color: var(--accent);
}
.gameover-actions {
display: flex;
gap: 0.75rem;
justify-content: center;
margin-top: 1rem;
}
/* ---------- hand-end scoring summary ---------- */
.summary-panel {
min-width: 420px;
max-width: 560px;
text-align: left;
}
.summary-panel h2 {
text-align: center;
margin-top: 0;
}
.score-rows {
display: flex;
flex-direction: column;
gap: 0.4rem;
margin: 0.75rem 0;
}
.score-row {
display: flex;
align-items: center;
gap: 0.75rem;
background: var(--panel-light);
border-left: 4px solid transparent;
border-radius: 8px;
padding: 0.45rem 0.75rem;
}
.score-row.team-a {
border-left-color: var(--team-a);
}
.score-row.team-b {
border-left-color: var(--team-b);
}
.score-row.tie {
opacity: 0.65;
}
.score-icon {
width: 32px;
flex-shrink: 0;
display: flex;
justify-content: center;
}
.playing-card.score-mini {
height: 38px;
}
.score-body {
flex: 1;
}
.score-title {
font-weight: 700;
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--muted);
}
.score-text {
font-size: 0.95rem;
}
.score-points {
font-weight: 700;
white-space: nowrap;
}
.score-row.team-a .score-points {
color: var(--team-a);
}
.score-row.team-b .score-points {
color: var(--team-b);
}
.totals {
margin: 1rem 0;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.total-row {
display: grid;
grid-template-columns: 4.5rem 1fr 4rem;
gap: 0.6rem;
align-items: center;
}
.total-label {
font-weight: 600;
}
.total-value {
font-weight: 700;
text-align: right;
}
.gained {
margin-left: 0.35rem;
font-size: 0.85rem;
opacity: 0.85;
}
.total-row.team-a .gained {
color: var(--team-a);
}
.total-row.team-b .gained {
color: var(--team-b);
}
.progress {
height: 10px;
background: rgba(0, 0, 0, 0.35);
border-radius: 999px;
overflow: hidden;
}
.progress-fill {
height: 100%;
border-radius: 999px;
transition: width 0.4s ease;
}
.total-row.team-a .progress-fill {
background: var(--team-a);
}
.total-row.team-b .progress-fill {
background: var(--team-b);
}
.summary-actions {
text-align: center;
margin-top: 0.5rem;
}
.final-score {
text-align: center;
font-size: 1.25rem;
font-weight: 700;
}
/* ---------- briscola ---------- */
.briscola-badge {
background: var(--panel-light);
color: var(--accent);
font-weight: 700;
border-radius: 999px;
padding: 0.15rem 0.6rem;
border: 1px solid var(--accent);
}
/* The face-down stock with the face-up trump card beside it. */
.stock {
display: flex;
align-items: center;
gap: 0.75rem;
}
.stock-pile {
display: flex;
}
.playing-card.stock-card {
height: 48px;
margin-left: -34px;
}
.playing-card.stock-card:first-child {
margin-left: 0;
}
.playing-card.briscola-card {
height: 64px;
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.stock-count {
color: var(--muted);
font-size: 0.8rem;
font-variant-numeric: tabular-nums;
}
/* Current-trick cards with the player's name above each. */
.trick-slot {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.15rem;
}
.trick-name {
font-size: 0.7rem;
color: var(--muted);
}
/* Two-player table: opponent on top, player at the bottom. */
.table-grid.duo {
grid-template-columns: 1fr;
grid-template-rows: auto 1fr auto;
grid-template-areas:
"top"
"center"
"bottom";
}