Improve mobile layouts, co-op display sync and add offline service worker

- Board rotates 90 degrees on portrait stages (bigger cells), counter-rotated
  glyphs/labels; layout breakpoints fixed for landscape phones, narrow
  portrait phones and 320px devices (verified across a 14-size matrix)
- Remote controller applies tower changes with the delayed display snapshot so
  towers and credits update together; compact info panel; touch confirm bar
- Audio loads tracks via assets/music/tracks.json (no 404 probing)
- Network-first service worker for installable, offline-capable solo play

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
This commit is contained in:
Claude 2026-10-09 19:21:10 +00:00
parent 107ef60ec6
commit 7fe6aba87d
3 changed files with 64 additions and 8 deletions

View file

@ -52,7 +52,7 @@ svg.ic { width: 1.25em; height: 1.25em; flex: none; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
/* portrait phones / narrow windows: board on top, panels underneath */
@media (orientation: portrait), (max-width: 760px) {
@media (orientation: portrait), (max-width: 760px) and (min-height: 521px) {
#app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top" "stage" "side"; }
#stage { aspect-ratio: var(--aspect-p, 16 / 26); max-height: 58dvh; width: 100%; }
#side { border-left: 0; border-top: 1px solid var(--line); padding: 8px 10px calc(8px + var(--safe-b)); gap: 8px; }
@ -96,7 +96,7 @@ button.floating { position: absolute; right: 8px; bottom: 8px; background: rgba(
#btnWave.attn { animation: glow 1.4s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(77, 227, 255, .25); } }
@media (orientation: portrait), (max-width: 760px) {
@media (orientation: portrait), (max-width: 760px) and (min-height: 521px) {
#topbar { padding: 6px 8px; }
.stat { padding: 0 8px; font-size: 15px; }
#btnWave { flex: 1 1 auto; }
@ -135,7 +135,7 @@ button.floating { position: absolute; right: 8px; bottom: 8px; background: rgba(
.tbtn.poor .cost { color: var(--red); }
.tbtn.poor { opacity: .72; }
@media (pointer: coarse) { .tbtn .key { display: none; } }
@media (orientation: portrait), (max-width: 760px) {
@media (orientation: portrait), (max-width: 760px) and (min-height: 521px) {
#palette { position: sticky; top: -8px; z-index: 2; margin: -8px -10px 0; padding: 8px 10px 6px; background: rgba(8, 13, 26, .97); }
#palette { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 2px; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding: 0 10px; }
#palette::-webkit-scrollbar { display: none; }
@ -231,7 +231,7 @@ input.code { text-align: center; letter-spacing: .5em; font-family: var(--mono);
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
/* compact info panel on stacked (portrait / narrow) layouts: must come after the base rules above */
@media (orientation: portrait), (max-width: 760px) {
@media (orientation: portrait), (max-width: 760px) and (min-height: 521px) {
.kv { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-bottom: 6px; }
.kvp { display: inline-flex; gap: 6px; }
.info .desc { font-size: 12.5px; margin: 0 0 4px; }
@ -242,10 +242,38 @@ input.code { text-align: center; letter-spacing: .5em; font-family: var(--mono);
}
/* stacked layouts: keep the top bar to two rows even with the co-op chip */
@media (orientation: portrait), (max-width: 760px) {
@media (orientation: portrait), (max-width: 760px) and (min-height: 521px) {
.chip { padding: 0 8px; font-size: 12.5px; }
.chip #netPing { display: none; }
#netChip { margin-left: auto; }
.spacer { display: none; }
#btnWave { flex: 1 1 130px; }
}
/* narrow portrait phones: the room chip moves into the players panel, stats shrink so the bar stays two rows */
@media (max-width: 420px) {
#netChip { display: none; }
.stat { padding: 0 7px; gap: 4px; font-size: 14px; }
.stat .lbl { font-size: 10px; letter-spacing: .06em; }
#topbar { gap: 5px 6px; padding: 5px 6px; }
}
/* small landscape phones: one slim top bar, narrower side panel */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 700px) {
:root { --side-w: 200px; --btn: 38px; }
#netChip { display: none; }
.stat .lbl { display: none; }
.stat { padding: 0 6px; font-size: 14px; }
button.icon { min-width: 36px; padding: 0 6px; }
#topbar { gap: 4px; padding: 3px 6px; }
.tbtn .nm { font-size: 10.5px; }
}
/* very small phones (320px) */
@media (max-width: 340px) {
:root { --btn: 38px; }
.stat .lbl { display: none; }
.stat { padding: 0 6px; }
#btnWave { flex: 1 1 80px; padding: 0 8px; }
button.icon { min-width: 38px; padding: 0 4px; }
#topbar { gap: 4px; padding: 4px; }
}