Make the game table usable on phones
CI / Build and push docker image (push) Successful in 1m3s

The game page was wider than the viewport on mobile (528px at 390px).

- HUD: wrap its items instead of one non-wrapping row, which clipped the
  left items and pushed the page wider than the screen.
- Table grid: use minmax(0, ...) tracks and allow the seat panels and
  centre to shrink; wrap the seat name and move banner; under 576px trim
  paddings/gaps, shrink the cards and let the hidden-hand backs wrap.
- Deal summary and pickers: cap their width at the viewport so the
  420px/320px minimums no longer overflow narrow screens.
- Stock pile: the card backs overlapped so much they collapsed into a
  single card; reduce the negative margin so the stack reads as a stack.
This commit is contained in:
2026-10-06 16:56:01 +08:00
parent 97d4b3f217
commit 6222e38da3
+134 -7
View File
@@ -37,7 +37,8 @@ body {
.hud {
display: flex;
gap: 1.5rem;
flex-wrap: wrap;
gap: 0.4rem 1.5rem;
align-items: center;
justify-content: center;
padding: 0.6rem 1rem;
@@ -76,7 +77,10 @@ body {
.table-grid {
flex: 1;
display: grid;
grid-template-columns: 1fr 2.4fr 1fr;
/* minmax(0, …) lets the tracks shrink below their content's
* min-content width; without it the center's move banner and the
* seat panels push the grid wider than the screen on phones. */
grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr) minmax(0, 1fr);
grid-template-rows: auto 1fr auto;
grid-template-areas:
". top ."
@@ -114,6 +118,7 @@ body {
flex-direction: column;
justify-content: flex-start;
min-height: 116px;
min-width: 0;
align-self: center;
width: 100%;
}
@@ -126,7 +131,8 @@ body {
.seat-name {
font-weight: 600;
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
gap: 0.15rem 0.5rem;
align-items: center;
justify-content: center;
}
@@ -167,6 +173,7 @@ body {
justify-content: center;
gap: 0.75rem;
min-height: 230px;
min-width: 0;
}
.table-cards {
@@ -240,8 +247,11 @@ body {
.move-banner {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 0.4rem;
max-width: 100%;
background: rgba(0, 0, 0, 0.35);
border-radius: 999px;
padding: 0.35rem 1rem;
@@ -292,7 +302,8 @@ body {
border-radius: 14px;
padding: 1.5rem 2rem;
text-align: center;
min-width: 320px;
min-width: min(320px, calc(100vw - 1.5rem));
max-width: calc(100vw - 1.5rem);
}
.capture-options {
@@ -327,8 +338,8 @@ body {
/* ---------- hand-end scoring summary ---------- */
.summary-panel {
min-width: 420px;
max-width: 560px;
min-width: min(420px, calc(100vw - 1.5rem));
max-width: min(560px, calc(100vw - 1.5rem));
text-align: left;
}
@@ -499,7 +510,7 @@ body {
.playing-card.stock-card {
height: 48px;
margin-left: -34px;
margin-left: -18px;
}
.playing-card.stock-card:first-child {
@@ -540,3 +551,119 @@ body {
"center"
"bottom";
}
/* ---------- phones ---------- */
@media (max-width: 576px) {
.hud {
gap: 0.3rem 0.75rem;
padding: 0.45rem 0.5rem;
font-size: 0.85rem;
}
.table-grid {
gap: 0.35rem;
padding: 0.4rem;
}
.seat {
min-height: 92px;
padding: 0.35rem 0.4rem;
}
.seat-name {
font-size: 0.85rem;
}
.team-badge {
font-size: 0.6rem;
}
.seat-stats {
font-size: 0.7rem;
}
/* Flex-wrap lets the hidden-hand backs drop to the next row instead
* of forcing the seat wider than its track. */
.seat-cards {
display: flex;
flex-wrap: wrap;
gap: 2px;
justify-content: center;
margin: 0.2rem 0;
}
.center {
min-height: 180px;
gap: 0.45rem;
}
.move-banner {
font-size: 0.8rem;
padding: 0.25rem 0.6rem;
}
.playing-card.mini {
height: 26px;
}
.playing-card.table-card {
height: 62px;
}
.playing-card.move-card {
height: 42px;
}
.playing-card.hand-card {
height: 92px;
}
.hand {
min-height: 100px;
gap: 0.35rem;
}
.stock {
gap: 0.4rem;
}
.playing-card.stock-card {
height: 38px;
margin-left: -12px;
}
.playing-card.briscola-card {
height: 50px;
}
.picker {
padding: 1rem 1.1rem;
}
.summary-panel h2 {
font-size: 1.25rem;
}
.score-row {
gap: 0.5rem;
padding: 0.35rem 0.5rem;
}
.score-text {
font-size: 0.85rem;
}
.score-icon {
width: 26px;
}
.playing-card.score-mini {
height: 30px;
}
.total-row {
grid-template-columns: 3.5rem 1fr 3.2rem;
gap: 0.4rem;
}
}