From 1530afabfd0cb118440b59b91e3ef8f160deb9f5 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Tue, 28 Apr 2026 22:33:12 +0700 Subject: [PATCH] docs(plans): log mobile dpad spacing review and tightening plan --- .../phase-01-tighten-mobile-layout.md | 170 ++++++++++++ .../plan.md | 51 ++++ ...x-260428-2218-mobile-dpad-board-spacing.md | 241 ++++++++++++++++++ 3 files changed, 462 insertions(+) create mode 100644 plans/260428-2228-mobile-dpad-board-tightening/phase-01-tighten-mobile-layout.md create mode 100644 plans/260428-2228-mobile-dpad-board-tightening/plan.md create mode 100644 plans/reports/ui-ux-260428-2218-mobile-dpad-board-spacing.md diff --git a/plans/260428-2228-mobile-dpad-board-tightening/phase-01-tighten-mobile-layout.md b/plans/260428-2228-mobile-dpad-board-tightening/phase-01-tighten-mobile-layout.md new file mode 100644 index 0000000..655ebe0 --- /dev/null +++ b/plans/260428-2228-mobile-dpad-board-tightening/phase-01-tighten-mobile-layout.md @@ -0,0 +1,170 @@ +# Phase 01 — Tighten Mobile Vertical Layout + +**Priority:** P1 +**Status:** pending +**Mode:** CSS only, gated `@media (pointer: coarse)`. Zero JS, zero markup. + +## Context Links + +- Review: `plans/reports/ui-ux-260428-2218-mobile-dpad-board-spacing.md` +- Prior fix that established the current flex layout: commit `c80b9ce` (kill footer mistouch / dock-board overlap). +- Footer-on-desktop restore: commit `d5b8aef`. + +## Overview + +Close the visible "too far" band between board and D-pad on phones by: +1. Anchoring the board to the bottom of `.board-wrap` (R1 — main win). +2. Removing redundant bottom padding on `#app` (R2 — dock owns its own bottom inset). +3. Tightening the `.game` flex gap (R3). + +All three are CSS-only and live behind one media query so desktop is untouched. + +## Key Insights (from review report) + +- Seam between board and dock = exactly `16px` (`.game gap`) — fine on its own. +- Real culprit: `` is fixed-pixel and renders top-left inside `flex:1` `.board-wrap`. Short puzzles leave **~319px** of invisible dead space *below* the board on a Pixel 7. +- Compounding: `#app` adds 24px bottom padding *under* the dock that already pads `12px + safe-area`. +- Combined fix moves the seam to **~10px**. + +## Requirements + +**Functional** + +- F1. On `@media (pointer: coarse)` the puzzle board's bottom edge sits within ~12px of the dock top edge for puzzles that fit the viewport. +- F2. On `@media (pointer: fine)` (desktop) the layout is pixel-identical to current `main`. +- F3. Tall puzzles still scroll inside `.board-wrap` without overlapping the dock. + +**Non-functional** + +- N1. No JS changes. +- N2. No new files; edit in place. +- N3. Touch targets unchanged (D-pad arrows stay 56px, action buttons stay 44px). + +## Architecture + +Affected layers: + +``` +#app ← R2 (mobile padding override) +└── .game ← R3 (mobile gap override) + ├── .hud + ├── .board-wrap ← R1 (mobile flex-end anchoring) + max-width tweak + │ └── (fixed-pixel, untouched) + └── (.mobile-dock — untouched in this phase) +``` + +## Related Code Files + +**Modify** + +- `src/app.css` — add coarse-pointer override on `#app` padding. +- `src/views/GameView.svelte` — add coarse-pointer overrides on `.board-wrap` (flex-end anchoring + max-width) and `.game` (gap 10px). + +**Read for context (do not modify)** + +- `src/views/MobileControls.svelte` — confirms dock keeps its own `padding-bottom: 12px + env(safe-area-inset-bottom)`. + +**Create** + +- None. + +**Delete** + +- None. + +## Implementation Steps + +### 1. `src/app.css` — R2 mobile padding override + +After the existing `#app` rule, add: + +```css +@media (pointer: coarse) { + #app { + padding: 12px 12px 0; + } +} +``` + +Rationale: dock already pads `12px + env(safe-area-inset-bottom)`. Doubling was wasteful. Lateral 12px is plenty around the board. + +### 2. `src/views/GameView.svelte` — R1 board anchoring + R3 gap + +Inside the existing `