diff --git a/.vs/Calorie Tracker.slnx/v18/.wsuo b/.vs/Calorie Tracker.slnx/v18/.wsuo
new file mode 100644
index 0000000..779a895
Binary files /dev/null and b/.vs/Calorie Tracker.slnx/v18/.wsuo differ
diff --git a/.vs/Calorie Tracker.slnx/v18/DocumentLayout.json b/.vs/Calorie Tracker.slnx/v18/DocumentLayout.json
new file mode 100644
index 0000000..dc3a118
--- /dev/null
+++ b/.vs/Calorie Tracker.slnx/v18/DocumentLayout.json
@@ -0,0 +1,12 @@
+{
+ "Version": 1,
+ "WorkspaceRootPath": "C:\\Users\\Elijah\\Desktop\\Calorie Tracker\\",
+ "Documents": [],
+ "DocumentGroupContainers": [
+ {
+ "Orientation": 0,
+ "VerticalTabListWidth": 256,
+ "DocumentGroups": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json
new file mode 100644
index 0000000..6b61141
--- /dev/null
+++ b/.vs/VSWorkspaceState.json
@@ -0,0 +1,6 @@
+{
+ "ExpandedNodes": [
+ ""
+ ],
+ "PreviewInSolutionExplorer": false
+}
\ No newline at end of file
diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite
new file mode 100644
index 0000000..e4bafcb
Binary files /dev/null and b/.vs/slnx.sqlite differ
diff --git a/README.md b/README.md
index a441ae0..d9edad9 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,14 @@ A single-user, self-hosted nutrition journal. PWA first, with a responsive deskt
- Markdown, CSV and JSON export with date range, nutrient and weight selections. Markdown is designed for LLM analysis. Data is downloaded locally, never submitted to an LLM. Save preferences to remember the export format, range preset and selections.
- Password authentication, IndexedDB offline journal/outbox, a precached app shell, automatic foreground/reconnect sync, and explicit PWA update prompts.
+### Phone layout
+
+On phones, Today fills the available screen, including iPhone safe areas, with the calorie circle, readout, macros and navigation visible together. **Food journal** opens the selected day's meals in a separate scrollable sheet; adding, editing and removing entries from it uses the same offline journal. Desktop retains the side-by-side dashboard and meals. Compact screens use the date picker instead of the full week strip, and landscape arranges the circle beside the totals. If more than three nutrient goals are enabled, swipe the macro row horizontally to see the rest.
+
+Phone controls use larger type, 44–56 px tap targets, and 51×31 px switches. Food entry uses full-width day/time/meal rows, explicitly constrained native input widths, and a sticky sheet header. Library, Weight and Settings scroll normally.
+
+The iPhone Home Screen icon uses a dark background and high-contrast mark so automatic tinting has a dark base instead of a bright colored square. The versioned Apple touch-icon URL lets new installations request the revised asset; Android keeps its existing regular and maskable icons. iOS owns the final tinted/clear rendering, so a PWA cannot guarantee the native Icon Composer appearance. If an existing Home Screen shortcut retains its old cached icon, first sync all pending entries, then add Calio to the Home Screen again. The server's database is unchanged.
+
Barcode lookup and nutrition-label OCR are deferred. This release uses manual nutrition entry and saved foods. It does not include Apple Watch integration, HealthKit, fasting, reminders or water tracking; those screenshot features were not part of the requested core.
## Deploy on Unraid
@@ -104,3 +112,5 @@ node scripts/container-smoke.js calio:local --unraid
```
App code is in `src/`, shared schemas/merge rules in `shared/`, and the Express/SQLite server in `server/`. The handwritten service worker is generated from production asset hashes by `scripts/build-sw.js`. Icons are committed PNGs; `scripts/generate-icons.ps1` regenerates them on Windows without external assets.
+
+The read-only browser regression expression in `tests/browser/mobile-layout.check.js` checks Today height, visible macros/readout, navigation type and tap targets, Settings switches, and food-editor input bounds. Load its text into the browser tool's `playwright.evaluate` at phone sizes, on Today, Settings, and an open food editor; `pass` must be true. Verify small/tall portrait screens, landscape, safe-area insets, all enabled macros, and journal-to-editor actions. It runs against rendered DOM rather than asserting stylesheet strings; it is separate from the Node-only unit suite.
diff --git a/index.html b/index.html
index af8ee42..356bec6 100644
--- a/index.html
+++ b/index.html
@@ -15,7 +15,11 @@
-
+
Calio · Everyday, in balance
diff --git a/public/icons/apple-touch-icon-v2.png b/public/icons/apple-touch-icon-v2.png
new file mode 100644
index 0000000..ff07f06
Binary files /dev/null and b/public/icons/apple-touch-icon-v2.png differ
diff --git a/public/icons/apple-touch-icon.png b/public/icons/apple-touch-icon.png
index 2ba6633..ff07f06 100644
Binary files a/public/icons/apple-touch-icon.png and b/public/icons/apple-touch-icon.png differ
diff --git a/scripts/build-sw.js b/scripts/build-sw.js
index 5950c10..a9d9d42 100644
--- a/scripts/build-sw.js
+++ b/scripts/build-sw.js
@@ -7,6 +7,7 @@ const shell = [
"/icon.svg",
"/manifest.webmanifest",
"/icons/apple-touch-icon.png",
+ "/icons/apple-touch-icon-v2.png",
"/icons/icon-192.png",
"/icons/icon-512.png",
"/icons/maskable-512.png",
diff --git a/scripts/container-smoke.js b/scripts/container-smoke.js
index 138da23..2d0028e 100644
--- a/scripts/container-smoke.js
+++ b/scripts/container-smoke.js
@@ -131,6 +131,7 @@ try {
"/sw.js",
"/manifest.webmanifest",
"/icons/apple-touch-icon.png",
+ "/icons/apple-touch-icon-v2.png",
])
assert.equal((await request(path)).status, 200, path);
const html = await (await request("/")).text();
diff --git a/scripts/generate-icons.ps1 b/scripts/generate-icons.ps1
index a5bd3f0..f567232 100644
--- a/scripts/generate-icons.ps1
+++ b/scripts/generate-icons.ps1
@@ -1,21 +1,25 @@
Add-Type -AssemblyName System.Drawing
$iconRoot = Join-Path $PSScriptRoot '../public/icons'
New-Item -ItemType Directory -Force -Path $iconRoot | Out-Null
-foreach ($iconSpec in @(@('icon-192.png',192), @('icon-512.png',512), @('maskable-512.png',512), @('apple-touch-icon.png',180))) {
+foreach ($iconSpec in @(@('icon-192.png',192), @('icon-512.png',512), @('maskable-512.png',512), @('apple-touch-icon.png',180), @('apple-touch-icon-v2.png',180))) {
$iconSize = [int]$iconSpec[1]
$bitmap = New-Object System.Drawing.Bitmap($iconSize,$iconSize)
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
$graphics.ScaleTransform($iconSize / 192.0, $iconSize / 192.0)
- $graphics.Clear([System.Drawing.ColorTranslator]::FromHtml('#8391ed'))
- $cream = New-Object System.Drawing.SolidBrush([System.Drawing.ColorTranslator]::FromHtml('#f5f5ef'))
+ $isAppleIcon = $iconSpec[0].StartsWith('apple-touch-icon')
+ $backgroundColor = if ($isAppleIcon) { '#121318' } else { '#8391ed' }
+ $glyphColor = if ($isAppleIcon) { '#f4f4f8' } else { '#f5f5ef' }
+ $leafColor = if ($isAppleIcon) { '#f4f4f8' } else { '#cad1ff' }
+ $graphics.Clear([System.Drawing.ColorTranslator]::FromHtml($backgroundColor))
+ $cream = New-Object System.Drawing.SolidBrush([System.Drawing.ColorTranslator]::FromHtml($glyphColor))
$ringPen = New-Object System.Drawing.Pen($cream,8)
$graphics.DrawEllipse($ringPen,48,54,96,96)
foreach ($point in @(@(72,112),@(95,122),@(118,112),@(96,99))) { $graphics.FillEllipse($cream,($point[0]-8),($point[1]-8),16,16) }
$leaf = New-Object System.Drawing.Drawing2D.GraphicsPath
$leaf.AddBezier(96,50,94,27,119,26,120,27)
$leaf.AddBezier(120,27,120,44,105,51,96,50)
- $green = New-Object System.Drawing.SolidBrush([System.Drawing.ColorTranslator]::FromHtml('#cad1ff'))
+ $green = New-Object System.Drawing.SolidBrush([System.Drawing.ColorTranslator]::FromHtml($leafColor))
$graphics.FillPath($green,$leaf)
$bitmap.Save((Join-Path $iconRoot $iconSpec[0]),[System.Drawing.Imaging.ImageFormat]::Png)
$graphics.Dispose(); $bitmap.Dispose(); $cream.Dispose(); $ringPen.Dispose(); $leaf.Dispose(); $green.Dispose()
diff --git a/src/App.tsx b/src/App.tsx
index b88181e..6f27dc0 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -207,6 +207,106 @@ function SignIn({
);
}
+function MealJournal({
+ dayEntries,
+ settings,
+ add,
+ edit,
+ remove,
+}: {
+ dayEntries: JournalRecord[];
+ settings: SettingsData;
+ add: (meal: Meal) => void;
+ edit: (record: JournalRecord) => void;
+ remove: (record: JournalRecord) => void;
+}) {
+ const mealIcons = {
+ Breakfast: Coffee,
+ Lunch: Sun,
+ Dinner: Moon,
+ Snacks: Sparkles,
+ };
+ return (
+
+
+
+ SAVOR THE EVERYDAY
+
On the menu
+
+
+ {dayEntries.length} {dayEntries.length === 1 ? "entry" : "entries"}
+
+
+ {meals.map((meal) => {
+ const rows = dayEntries
+ .filter((r) => r.data.meal === meal)
+ .sort(
+ (a, b) =>
+ (a.data.time || "").localeCompare(b.data.time || "") ||
+ a.id.localeCompare(b.id),
+ );
+ const calories = totalNutrients(rows.map((r) => r.data)).calories;
+ const Icon = mealIcons[meal];
+ return (
+
+
+
+
+
+
{meal}
+ {rows.length > 0 && (
+
+ {number(calories)} kcal
+
+ )}
+
add(meal)}
+ >
+
+
+
+ {rows.length ? (
+ rows.map((r) => (
+
+ edit(r)}>
+ {r.data.name}
+
+ {r.data.time
+ ? displayTime(r.data.time)
+ : "Time not recorded"}{" "}
+ · {number(r.data.quantity, 2)} × {r.data.serving}
+ {settings.goals.protein.enabled
+ ? ` · ${number(r.data.nutrients.protein * r.data.quantity, 1)}g protein`
+ : ""}
+
+
+
+ {number(r.data.nutrients.calories * r.data.quantity)}
+ kcal
+
+ remove(r)}
+ >
+
+
+
+ ))
+ ) : (
+
add(meal)}>
+ Something good belongs here.
+
+
+ )}
+
+ );
+ })}
+
+ );
+}
function Dashboard({
records,
settings,
@@ -216,6 +316,7 @@ function Dashboard({
edit,
remove,
openLibrary,
+ syncControl,
}: {
records: JournalRecord[];
settings: SettingsData;
@@ -225,7 +326,10 @@ function Dashboard({
edit: (r: JournalRecord) => void;
remove: (r: JournalRecord) => void;
openLibrary: () => void;
+ syncControl: ReactNode;
}) {
+ const [journalOpen, setJournalOpen] = useState(false);
+ const closeJournal = useCallback(() => setJournalOpen(false), []);
const entries = recordsOf(records, "entry");
const dayEntries = entries.filter((r) => r.data.date === date);
const totals = totalNutrients(dayEntries.map((r) => r.data));
@@ -243,18 +347,18 @@ function Dashboard({
(m) => m.key !== "calories" && settings.goals[m.key].enabled,
);
const goal = settings.goals.calories;
- const mealIcons = {
- Breakfast: Coffee,
- Lunch: Sun,
- Dinner: Moon,
- Snacks: Sparkles,
- };
+
return (
<>
-
+
EVERYDAY, IN BALANCE
-
+
+ {date === today()
+ ? "Today"
+ : displayDate(date, { weekday: "long" })}
+
+
{date === today()
? "A little better, today"
: displayDate(date, { weekday: "long" })}
@@ -270,6 +374,7 @@ function Dashboard({
+
{syncControl}
{date === today()
@@ -359,7 +464,12 @@ function Dashboard({
{tracked.length > 0 ? (
-
+
3 ? 0 : -1}
+ >
{tracked.map((m) => {
const target = settings.goals[m.key].target;
return (
@@ -392,6 +502,15 @@ function Dashboard({
Your day, with only the details you choose to track.
)}
+
setJournalOpen(true)}
+ >
+
+ Food journal
+ {dayEntries.length}
+
+
@@ -401,89 +520,14 @@ function Dashboard({
-
-
-
-
- SAVOR THE EVERYDAY
-
On the menu
-
-
- {dayEntries.length}{" "}
- {dayEntries.length === 1 ? "entry" : "entries"}
-
-
- {meals.map((meal) => {
- const rows = dayEntries
- .filter((r) => r.data.meal === meal)
- .sort(
- (a, b) =>
- (a.data.time || "").localeCompare(b.data.time || "") ||
- a.id.localeCompare(b.id),
- );
- const calories = totalNutrients(rows.map((r) => r.data)).calories;
- const Icon = mealIcons[meal];
- return (
-
-
-
-
-
-
{meal}
- {rows.length > 0 && (
-
- {number(calories)} kcal
-
- )}
-
add(meal)}
- >
-
-
-
- {rows.length ? (
- rows.map((r) => (
-
- edit(r)}
- >
- {r.data.name}
-
- {r.data.time
- ? displayTime(r.data.time)
- : "Time not recorded"}{" "}
- · {number(r.data.quantity, 2)} × {r.data.serving}
- {settings.goals.protein.enabled
- ? ` · ${number(r.data.nutrients.protein * r.data.quantity, 1)}g protein`
- : ""}
-
-
-
- {number(r.data.nutrients.calories * r.data.quantity)}
- kcal
-
- remove(r)}
- >
-
-
-
- ))
- ) : (
-
add(meal)}>
- Something good belongs here.
-
-
- )}
-
- );
- })}
-
+
+
@@ -496,6 +540,30 @@ function Dashboard({
+ {journalOpen && (
+
+ {
+ closeJournal();
+ add(meal);
+ }}
+ edit={(record) => {
+ closeJournal();
+ edit(record);
+ }}
+ remove={(record) => {
+ closeJournal();
+ remove(record);
+ }}
+ />
+
+ )}
✳ A little consistency. A lot of
possibility.
@@ -532,9 +600,9 @@ function Library({
FAMILIAR FAVORITES
- Your everyday staples.
+ Library.
-
A little less effort, every time you log.
+
Foods, plates and nutrition history.
{tab !== "trends" && (
(status.needsLogin ? setReauth(true) : void sync())}
+ aria-label={syncLabel}
+ title={status.error || syncLabel}
+ >
+ {!status.online ? (
+
+ ) : status.busy ? (
+
+ ) : status.needsLogin ? (
+
+ ) : (
+
+ )}
+ {syncLabel}
+
+ );
return (
-
+
-
(status.needsLogin ? setReauth(true) : void sync())}
- title={status.error || syncLabel}
- >
- {!status.online ? (
-
- ) : status.busy ? (
-
- ) : status.needsLogin ? (
-
- ) : (
-
- )}
- {syncLabel}
-
+ {syncControl}
E
@@ -961,6 +1033,7 @@ export function App() {
}
remove={setDeleting}
openLibrary={() => setPage("library")}
+ syncControl={syncControl}
/>
)}
{page === "library" && (
diff --git a/src/Settings.tsx b/src/Settings.tsx
index c90fcd1..b1bc58d 100644
--- a/src/Settings.tsx
+++ b/src/Settings.tsx
@@ -100,9 +100,9 @@ export function Settings({
MAKE ROOM FOR YOU
- Your way.
+ Settings.
-
A journal that fits your everyday.
+
Goals, appearance and exports.
diff --git a/src/Trends.tsx b/src/Trends.tsx
index c770c77..fd62aa0 100644
--- a/src/Trends.tsx
+++ b/src/Trends.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { useEffect, useRef, useState } from "react";
import {
ArrowDownRight,
ArrowUpRight,
@@ -41,6 +41,8 @@ export function Trends({
const [period, setPeriod] = useState(7);
const [end, setEnd] = useState(today());
const [metric, setMetric] = useState
("calories");
+ const chartRef = useRef(null);
+ const [chartWidth, setChartWidth] = useState(600);
const start = offsetDay(end, 1 - period);
const entries = recordsOf(records, "entry");
const allWeights = recordsOf(records, "weight").sort(
@@ -55,6 +57,15 @@ export function Trends({
const dailyWeights = [
...new Map(weights.map((r) => [r.data.date, r])).values(),
];
+ const hasWeights = dailyWeights.length > 0;
+ useEffect(() => {
+ if (!chartRef.current) return;
+ const observer = new ResizeObserver(([entry]) =>
+ setChartWidth(Math.max(160, entry.contentRect.width)),
+ );
+ observer.observe(chartRef.current);
+ return () => observer.disconnect();
+ }, [mode, hasWeights]);
const days = Array.from({ length: period }, (_, i) => {
const date = offsetDay(start, i);
const logs = entries.filter((r) => r.data.date === date);
@@ -83,7 +94,7 @@ export function Trends({
28 +
((new Date(r.data.date).getTime() - new Date(start).getTime()) /
((period - 1) * 86400000)) *
- 544,
+ (chartWidth - 56),
y: 170 - ((values[i] - minWeight) / (maxWeight - minWeight)) * 140,
}));
const delta = values.length > 1 ? values.at(-1)! - values[0] : null;
@@ -238,29 +249,29 @@ export function Trends({
{number(values.at(-1)!, 1)} {settings.unit}
-
+
{displayDate(start, { month: "short", day: "numeric" })}
-
+
{displayDate(end, { month: "short", day: "numeric" })}
diff --git a/src/main.tsx b/src/main.tsx
index c113af2..79e31b4 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -2,6 +2,7 @@ import React from "react";
import { createRoot } from "react-dom/client";
import { App } from "./App";
import "./styles.css";
+import "./mobile.css";
createRoot(document.getElementById("root")!).render(
diff --git a/src/mobile.css b/src/mobile.css
new file mode 100644
index 0000000..e0536f0
--- /dev/null
+++ b/src/mobile.css
@@ -0,0 +1,1001 @@
+/* Phone layout: readable type, touch-sized controls, and a viewport-sized Today. */
+.mobile-today-title,
+.mobile-journal-button,
+.mobile-home-sync {
+ display: none;
+}
+
+@media (max-width: 760px), (max-width: 1000px) and (max-height: 500px) {
+ :root {
+ --safe-top: env(safe-area-inset-top, 0px);
+ --safe-bottom: env(safe-area-inset-bottom, 0px);
+ --mobile-nav-height: calc(76px + var(--safe-bottom));
+ -webkit-text-size-adjust: 100%;
+ text-size-adjust: 100%;
+ }
+ body {
+ font-size: 16px;
+ }
+ .sidebar {
+ display: none;
+ }
+ .main-wrap {
+ margin-left: 0;
+ padding-bottom: var(--mobile-nav-height);
+ }
+ .breadcrumb,
+ .profile-avatar,
+ .desktop-add {
+ display: none;
+ }
+ .topbar .mobile-brand {
+ display: flex;
+ margin-right: auto;
+ }
+ .topbar {
+ height: auto;
+ min-height: calc(60px + var(--safe-top));
+ padding: calc(8px + var(--safe-top)) 20px 8px;
+ }
+ .topbar .brand {
+ font-size: 25px;
+ }
+ .topbar .brand img {
+ width: 28px;
+ height: 28px;
+ }
+ .sync-indicator {
+ font-size: 12px;
+ gap: 6px;
+ min-height: 44px;
+ }
+ main {
+ padding: 20px 20px 24px;
+ }
+ .page-heading {
+ gap: 14px;
+ margin-bottom: 24px;
+ align-items: center;
+ }
+ .page-heading h1 {
+ font-size: 32px;
+ letter-spacing: -1px;
+ margin: 0 0 8px;
+ }
+ .page-heading p {
+ font-size: 15px;
+ line-height: 1.4;
+ }
+ .page-heading .eyebrow,
+ .card-title .eyebrow,
+ .sheet-head .eyebrow {
+ display: none;
+ }
+ .card-title {
+ gap: 12px;
+ margin-bottom: 20px;
+ }
+ .card-title h2,
+ .settings-card .card-title h2,
+ .weight-journal .card-title h2 {
+ font-size: 24px;
+ }
+ .primary,
+ .secondary,
+ .danger-button,
+ .page-heading > .primary {
+ min-height: 50px;
+ font-size: 16px;
+ padding: 12px 16px;
+ border-radius: 14px;
+ }
+ .icon-button {
+ min-width: 44px;
+ min-height: 44px;
+ width: 44px;
+ height: 44px;
+ }
+ .text-button {
+ min-height: 44px;
+ font-size: 15px;
+ }
+ .small,
+ .settings-card .small,
+ .install-tip {
+ font-size: 14px;
+ line-height: 1.5;
+ }
+ .pill,
+ .weight-journal .pill,
+ .tiny-badge {
+ font-size: 12px;
+ padding: 8px 10px;
+ }
+ .subtle-number {
+ font-size: 14px;
+ }
+ .bottom-nav {
+ display: grid;
+ grid-template-columns: 1fr 1fr 1.2fr 1fr 1fr;
+ position: fixed;
+ align-items: center;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ z-index: 10;
+ border-top: 1px solid var(--line);
+ background: var(--nav-bg);
+ backdrop-filter: blur(18px);
+ height: var(--mobile-nav-height);
+ padding: 8px 12px calc(8px + var(--safe-bottom));
+ gap: 4px;
+ }
+ .bottom-nav > button {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ color: var(--muted);
+ height: 56px;
+ gap: 5px;
+ min-width: 0;
+ }
+ .bottom-nav > button > svg {
+ width: 25px;
+ height: 25px;
+ }
+ .bottom-nav > button > span {
+ font-size: 12px;
+ }
+ .bottom-nav > button.active {
+ color: var(--accent-text);
+ }
+ .bottom-nav > .nav-add {
+ background: var(--accent);
+ color: var(--on-accent);
+ margin: auto;
+ width: 56px;
+ height: 56px;
+ border-radius: 19px;
+ }
+ .bottom-nav > .nav-add svg {
+ width: 30px;
+ height: 30px;
+ }
+ .toast {
+ font-size: 15px;
+ bottom: calc(var(--mobile-nav-height) + 12px);
+ padding: 14px 18px;
+ }
+ .notice {
+ font-size: 14px;
+ padding: 12px;
+ }
+ .notice > button {
+ font-size: 14px;
+ min-height: 44px;
+ }
+
+ /* The home is a dashboard, not the top of a scrolling journal. */
+ html:has(.page-today),
+ body:has(.page-today) {
+ height: 100%;
+ overflow: hidden;
+ overscroll-behavior-y: none;
+ }
+ .page-today {
+ height: 100vh;
+ height: 100dvh;
+ overflow: hidden;
+ }
+ .page-today .main-wrap {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ padding-top: var(--safe-top);
+ padding-bottom: var(--mobile-nav-height);
+ }
+ .page-today .topbar {
+ display: none;
+ }
+ .page-today main {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+ width: 100%;
+ padding: 12px 20px 10px;
+ }
+ .today-heading {
+ flex: none;
+ margin: 0 0 8px;
+ position: relative;
+ display: block;
+ }
+ .today-heading .desktop-today-title {
+ display: none;
+ }
+ .mobile-today-title {
+ display: block;
+ }
+ .today-heading .mobile-today-title {
+ font-size: 32px;
+ margin: 0 104px 4px 0;
+ }
+ .today-heading p {
+ font-size: 15px;
+ }
+ .today-heading .heading-actions {
+ position: absolute;
+ top: 0;
+ right: 0;
+ gap: 6px;
+ }
+ .mobile-home-sync {
+ display: block;
+ }
+ .mobile-home-sync .sync-indicator {
+ width: 44px;
+ height: 48px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ .mobile-home-sync .sync-indicator > span:last-child {
+ display: none;
+ }
+ .mobile-home-sync .status-dot {
+ width: 8px;
+ height: 8px;
+ }
+ .today-heading .date-picker-button {
+ display: flex;
+ width: 48px;
+ min-width: 48px;
+ height: 48px;
+ border-radius: 16px;
+ padding: 12px;
+ }
+ .today-heading .date-picker-button > span {
+ display: none;
+ }
+ .page-today .dashboard-grid {
+ flex: 1;
+ min-height: 0;
+ display: flex;
+ gap: 0;
+ }
+ .page-today .balance-card {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+ padding: 0;
+ border: 0;
+ border-radius: 0;
+ background: transparent;
+ box-shadow: none;
+ overflow: visible;
+ }
+ .page-today .balance-card > .card-title,
+ .page-today .balance-footer,
+ .page-today .desktop-journal,
+ .page-today .page-footnote {
+ display: none;
+ }
+ .page-today .week-strip {
+ flex: none;
+ height: 60px;
+ margin: 0 -10px 4px;
+ gap: 0;
+ }
+ .page-today .week-day {
+ flex: 1;
+ min-width: 0;
+ height: 58px;
+ min-height: 58px;
+ padding: 5px 0;
+ gap: 3px;
+ border-radius: 20px;
+ }
+ .page-today .week-day strong {
+ font-size: 17px;
+ }
+ .page-today .week-day > span {
+ font-size: 12px;
+ }
+ .page-today .week-arrow {
+ min-width: 26px;
+ width: 26px;
+ padding: 0;
+ }
+ .page-today .orb-shell {
+ flex: 1;
+ min-height: 0;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ container-type: size;
+ }
+ .page-today .orb {
+ flex: none;
+ width: min(100%, calc(100dvh - 440px));
+ height: auto;
+ margin: 0;
+ }
+ @supports (width: 1cqh) {
+ .page-today .orb {
+ width: min(100cqw, max(0px, calc(100cqh - 90px)));
+ }
+ }
+ .page-today .orb-number.orb-number-outside {
+ flex: none;
+ min-height: 80px;
+ margin: 6px 0 0;
+ gap: 2px;
+ }
+ .page-today .orb-number.orb-number-outside strong {
+ font-size: 46px;
+ line-height: 1.05;
+ }
+ .page-today .orb-number.orb-number-outside .eyebrow {
+ font-size: 11px;
+ letter-spacing: 1.5px;
+ }
+ .page-today .orb-number.orb-number-outside .orb-unit {
+ font-size: 14px;
+ }
+ .page-today .calorie-summary {
+ flex: none;
+ height: 38px;
+ padding: 4px 0 10px;
+ gap: 18px;
+ }
+ .page-today .calorie-summary > div {
+ font-size: 13px;
+ gap: 6px;
+ }
+ .page-today .calorie-summary strong {
+ font-size: 18px;
+ }
+ .page-today .macro-grid {
+ flex: none;
+ flex-wrap: nowrap;
+ gap: 16px;
+ padding: 12px 0 14px;
+ min-height: 84px;
+ overflow-x: auto;
+ overflow-y: hidden;
+ scroll-snap-type: x mandatory;
+ scrollbar-width: thin;
+ }
+ .page-today .macro-grid:has(.macro:nth-child(4)) {
+ justify-content: flex-start;
+ }
+ .page-today .macro-grid > .macro {
+ flex: 0 0 calc((100% - 32px) / 3);
+ scroll-snap-align: start;
+ }
+ .page-today .macro-label {
+ font-size: 14px;
+ gap: 5px;
+ margin-bottom: 7px;
+ }
+ .page-today .macro strong {
+ font-size: 24px;
+ }
+ .page-today .macro > div > span {
+ font-size: 12px;
+ }
+ .page-today .progress-track {
+ height: 6px;
+ margin-top: 9px;
+ }
+ .page-today .balance-card > .centered {
+ flex: none;
+ font-size: 14px;
+ margin: 10px 0;
+ }
+ .mobile-journal-button {
+ display: flex;
+ flex: none;
+ gap: 10px;
+ width: 100%;
+ margin-top: 4px;
+ min-height: 48px;
+ }
+ .mobile-journal-button > span:first-of-type {
+ flex: 1;
+ text-align: left;
+ }
+ .journal-count {
+ color: var(--muted);
+ font-size: 15px;
+ }
+ .page-today main > .notice {
+ flex: none;
+ max-height: 100px;
+ overflow-y: auto;
+ margin-bottom: 6px;
+ }
+
+ /* Native Safari controls must never contribute an intrinsic grid width. */
+ label {
+ font-size: 16px;
+ }
+ input:not([type="checkbox"]),
+ select,
+ textarea,
+ .sheet input:not([type="checkbox"]),
+ .sheet select,
+ .sheet textarea,
+ .settings-card input:not([type="checkbox"]),
+ .settings-card select {
+ display: block;
+ box-sizing: border-box;
+ width: 100%;
+ inline-size: 100%;
+ min-width: 0;
+ min-inline-size: 0;
+ max-width: 100%;
+ max-inline-size: 100%;
+ min-height: 52px;
+ font-size: 18px;
+ line-height: 1.4;
+ padding: 12px 14px;
+ border-radius: 13px;
+ }
+ input[type="date"],
+ input[type="time"] {
+ appearance: none;
+ -webkit-appearance: none;
+ overflow: hidden;
+ }
+ input::-webkit-date-and-time-value {
+ text-align: left;
+ min-height: 1.4em;
+ }
+ input::-webkit-datetime-edit {
+ padding: 0;
+ min-width: 0;
+ }
+ .date-picker-button input {
+ position: absolute;
+ margin: 0;
+ min-height: 0;
+ height: 100%;
+ padding: 0;
+ }
+ .sheet {
+ width: calc(100% - 2px);
+ max-height: calc(100dvh - var(--safe-top) - 8px);
+ padding: 26px 20px calc(24px + var(--safe-bottom));
+ overflow-x: hidden;
+ }
+ .sheet-head {
+ position: sticky;
+ top: 0;
+ z-index: 3;
+ background: var(--surface);
+ padding: 8px 0 12px;
+ align-items: flex-start;
+ gap: 10px;
+ margin-bottom: 20px;
+ }
+ .sheet-head h2 {
+ font-size: 27px;
+ line-height: 1.2;
+ margin-top: 0;
+ }
+ .sheet-head p {
+ font-size: 15px;
+ line-height: 1.4;
+ }
+ .sheet-head > .icon-button {
+ margin: -4px -4px 0 0;
+ }
+ .sheet .segmented > button {
+ font-size: 15px;
+ min-height: 44px;
+ padding: 8px 5px;
+ white-space: normal;
+ }
+ .sheet .entry-details {
+ grid-template-columns: minmax(0, 1fr);
+ gap: 14px;
+ }
+ .sheet .entry-details > label:first-child {
+ grid-column: auto;
+ }
+ .sheet label {
+ font-size: 16px;
+ line-height: 1.4;
+ }
+ .sheet form > label,
+ .sheet form > .form-row {
+ margin-top: 20px;
+ }
+ .sheet .section-caption {
+ font-size: 15px;
+ flex-wrap: wrap;
+ gap: 4px;
+ }
+ .sheet .section-caption > span:last-child {
+ display: none;
+ }
+ .nutrient-fields {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 16px;
+ }
+ .nutrient-fields label:first-child {
+ font-size: 16px;
+ grid-column: 1 / -1;
+ padding: 10px 14px;
+ }
+ .settings-grid {
+ grid-template-columns: minmax(0, 1fr);
+ }
+ .nutrient-fields label:first-child .unit-input {
+ width: 55%;
+ min-width: 0;
+ }
+ .nutrient-fields label:first-child input {
+ font-size: 22px;
+ }
+ .sheet .unit-input > span,
+ .unit-input > span {
+ font-size: 14px;
+ padding-right: 12px;
+ }
+ .check-row,
+ .export-options .check-row {
+ min-height: 48px;
+ font-size: 16px;
+ gap: 12px;
+ }
+ .check-row input {
+ width: 24px;
+ height: 24px;
+ }
+ .sheet form > .primary {
+ min-height: 54px;
+ font-size: 17px;
+ }
+ .picker-row strong {
+ font-size: 17px;
+ }
+ .picker-row small {
+ font-size: 14px;
+ line-height: 1.5;
+ }
+ .error {
+ font-size: 15px;
+ }
+ .sheet .meals-card {
+ border: 0;
+ box-shadow: none;
+ background: transparent;
+ padding: 0;
+ }
+ .sheet .meals-card > .card-title {
+ display: none;
+ }
+ .meal-heading h3 {
+ font-size: 19px;
+ }
+ .meal-icon {
+ width: 40px;
+ height: 40px;
+ }
+ .meal-total {
+ font-size: 16px;
+ }
+ .food-log-row {
+ padding-left: 0;
+ gap: 8px;
+ padding-top: 10px;
+ }
+ .food-log-copy {
+ min-height: 54px;
+ padding: 6px 0;
+ }
+ .food-log-copy > strong {
+ font-size: 17px;
+ line-height: 1.4;
+ }
+ .food-log-copy > small {
+ font-size: 14px;
+ line-height: 1.5;
+ margin-top: 4px;
+ }
+ .entry-calories {
+ font-size: 19px;
+ }
+ .entry-calories small {
+ font-size: 12px;
+ }
+ .empty-meal {
+ min-height: 48px;
+ font-size: 15px;
+ margin-left: 0;
+ }
+ .delete-entry {
+ opacity: 1;
+ }
+
+ /* The remaining tabs scroll normally, with the same mobile type and targets. */
+ .settings-card,
+ .chart-card,
+ .weight-journal {
+ padding: 20px;
+ border-radius: 22px;
+ }
+ .settings-card > .muted,
+ .settings-card p,
+ .chart-note {
+ font-size: 15px;
+ }
+ .goal-head {
+ font-size: 12px;
+ margin-top: 24px;
+ }
+ .goal-row,
+ .settings-card .goal-row {
+ min-height: 78px;
+ padding: 12px 0;
+ gap: 10px;
+ }
+ .toggle-label {
+ font-size: 17px;
+ gap: 12px;
+ min-height: 48px;
+ }
+ .switch {
+ width: 51px;
+ height: 31px;
+ border-radius: 20px;
+ }
+ .switch:after {
+ width: 25px;
+ height: 25px;
+ top: 3px;
+ left: 3px;
+ }
+ .switch:checked:after {
+ transform: translateX(20px);
+ }
+ .goal-input {
+ width: 122px;
+ flex: none;
+ }
+ .settings-card .goal-input input {
+ font-size: 18px;
+ padding: 10px 6px;
+ }
+ .goal-input > span {
+ min-width: 28px;
+ padding-right: 8px;
+ font-size: 13px;
+ }
+ .settings-section h3 {
+ font-size: 20px;
+ }
+ .preference-row {
+ font-size: 16px;
+ flex-wrap: wrap;
+ }
+ .preference-row select {
+ width: auto;
+ max-width: 100%;
+ font-size: 16px;
+ }
+ .field-caption {
+ font-size: 12px;
+ }
+ .accent-swatches {
+ flex-wrap: wrap;
+ gap: 6px;
+ }
+ .accent-swatches > button {
+ width: 44px;
+ height: 44px;
+ }
+ .custom-accent {
+ font-size: 16px;
+ }
+ .custom-accent input[type="color"] {
+ width: 48px;
+ height: 48px;
+ min-height: 48px;
+ padding: 4px;
+ }
+ .segmented > button,
+ .theme-control > button,
+ .trend-controls > .segmented > button {
+ font-size: 15px;
+ min-height: 44px;
+ padding: 8px 6px;
+ }
+ .segmented > button > span {
+ font-size: 13px;
+ }
+ .library-controls > .segmented {
+ align-self: stretch;
+ }
+ .library-controls .search-field input {
+ font-size: 18px;
+ min-height: 52px;
+ padding-left: 44px;
+ }
+ .library-grid {
+ grid-template-columns: minmax(0, 1fr);
+ gap: 16px;
+ }
+ .library-card {
+ padding: 20px;
+ }
+ .library-food-info h3 {
+ font-size: 20px;
+ }
+ .library-food-info p {
+ font-size: 15px;
+ }
+ .food-macros {
+ font-size: 14px;
+ }
+ .library-card-actions .text-button {
+ font-size: 15px;
+ }
+ .empty {
+ padding: 32px 12px;
+ }
+ .empty h3 {
+ font-size: 21px;
+ }
+ .empty p {
+ font-size: 16px;
+ line-height: 1.55;
+ }
+ .library-empty {
+ min-height: 300px;
+ }
+ .library-bottom {
+ font-size: 14px;
+ gap: 12px;
+ }
+ .library-bottom > button {
+ margin-left: 0;
+ }
+ .date-controls {
+ font-size: 15px;
+ }
+ .stat-large {
+ font-size: 36px;
+ }
+ .stat-large > span {
+ font-size: 15px;
+ }
+ .chart-card select {
+ width: auto;
+ max-width: 52%;
+ font-size: 16px;
+ }
+ .bar-chart {
+ height: 220px;
+ }
+ .bar-slot > span,
+ .chart-grid-lines {
+ font-size: 12px;
+ }
+ .weight-chart {
+ height: 220px;
+ }
+ .weight-axis,
+ .weight-chart svg text {
+ font-size: 14px;
+ }
+ .journal-row {
+ gap: 10px;
+ }
+ .journal-row .row-copy strong {
+ font-size: 18px;
+ }
+ .journal-row .row-copy small {
+ font-size: 14px;
+ line-height: 1.5;
+ }
+ .export-options {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .login-form > label,
+ .login-form > p {
+ font-size: 16px;
+ }
+ .login-form > .primary {
+ min-height: 52px;
+ font-size: 17px;
+ }
+ .login-note {
+ font-size: 14px;
+ }
+ .status-detail strong {
+ font-size: 16px;
+ }
+ .status-detail small,
+ .account-row > div {
+ font-size: 14px;
+ }
+ .account-row small {
+ font-size: 12px;
+ }
+ .account-row .text-button {
+ font-size: 15px;
+ }
+}
+
+@media (max-width: 365px) {
+ .page-today main {
+ padding-inline: 16px;
+ }
+ main {
+ padding-inline: 16px;
+ }
+ .page-heading h1,
+ .today-heading .mobile-today-title {
+ font-size: 29px;
+ }
+ .page-today .macro-label {
+ font-size: 14px;
+ }
+ .page-today .macro > div > span {
+ font-size: 11px;
+ }
+ .page-today .macro strong {
+ font-size: 22px;
+ }
+ .goal-row .toggle-label {
+ font-size: 16px;
+ gap: 8px;
+ }
+ .goal-input {
+ width: 106px;
+ }
+ .settings-card {
+ padding-inline: 16px;
+ }
+}
+
+@media (max-width: 760px) and (max-height: 680px) {
+ .page-today main {
+ padding-top: 6px;
+ padding-bottom: 6px;
+ }
+ .today-heading .mobile-today-title {
+ font-size: 28px;
+ }
+ .today-heading p {
+ font-size: 14px;
+ }
+ .page-today .week-strip {
+ height: 52px;
+ margin-bottom: 0;
+ }
+ .page-today .week-day {
+ min-height: 50px;
+ height: 50px;
+ }
+ .page-today .orb-number.orb-number-outside {
+ min-height: 70px;
+ margin-top: 2px;
+ }
+ .page-today .orb-number.orb-number-outside strong {
+ font-size: 38px;
+ }
+ .page-today .macro-grid {
+ min-height: 78px;
+ padding: 8px 0 10px;
+ }
+}
+
+@media (max-width: 1000px) and (max-height: 500px) {
+ .page-today main {
+ padding: 6px 20px;
+ }
+ .today-heading {
+ margin-bottom: 4px;
+ }
+ .today-heading .mobile-today-title {
+ font-size: 25px;
+ }
+ .today-heading p {
+ font-size: 14px;
+ }
+ .page-today .balance-card {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
+ grid-template-rows: 40px 30px minmax(62px, 1fr) 44px;
+ column-gap: 20px;
+ }
+ .page-today .week-strip {
+ display: none;
+ }
+ .page-today .orb-shell {
+ display: contents;
+ container-type: normal;
+ }
+ .page-today .orb {
+ grid-column: 1;
+ grid-row: 1 / 5;
+ width: min(
+ 100%,
+ calc(100dvh - var(--safe-top) - var(--mobile-nav-height) - 72px)
+ );
+ justify-self: center;
+ align-self: center;
+ }
+ .page-today .orb-number.orb-number-outside {
+ grid-column: 2;
+ grid-row: 1;
+ flex-direction: row;
+ min-height: 40px;
+ margin: 0;
+ gap: 8px;
+ }
+ .page-today .orb-number.orb-number-outside .eyebrow {
+ max-width: 100px;
+ }
+ .page-today .orb-number.orb-number-outside strong {
+ font-size: 32px;
+ }
+ .page-today .calorie-summary {
+ grid-column: 2;
+ grid-row: 2;
+ height: 30px;
+ padding: 0;
+ gap: 10px;
+ }
+ .page-today .calorie-summary strong {
+ font-size: 16px;
+ }
+ .page-today .calorie-summary > div {
+ font-size: 11px;
+ gap: 4px;
+ }
+ .page-today .macro-grid {
+ grid-column: 2;
+ grid-row: 3;
+ min-height: 62px;
+ padding: 6px 0;
+ gap: 10px;
+ }
+ .page-today .macro-grid > .macro {
+ flex-basis: calc((100% - 20px) / 3);
+ }
+ .page-today .macro-label {
+ margin-bottom: 3px;
+ }
+ .page-today .macro strong {
+ font-size: 20px;
+ }
+ .page-today .macro > div > span {
+ font-size: 11px;
+ }
+ .page-today .progress-track {
+ margin-top: 5px;
+ }
+ .mobile-journal-button {
+ grid-column: 2;
+ grid-row: 4;
+ height: 44px;
+ min-height: 44px;
+ padding: 8px 12px;
+ margin: 0;
+ }
+}
+
+@media (max-width: 760px) and (min-height: 501px) and (max-height: 600px) {
+ .page-today .week-strip {
+ display: none;
+ }
+}
diff --git a/tests/browser/mobile-layout.check.js b/tests/browser/mobile-layout.check.js
new file mode 100644
index 0000000..038ef91
--- /dev/null
+++ b/tests/browser/mobile-layout.check.js
@@ -0,0 +1,37 @@
+// Run this expression with the browser tool's read-only evaluate API at phone sizes.
+// Exercise Today, Settings and an open food editor; every returned check must pass.
+(() => {
+ const checks = {};
+ const font = (element) => getComputedStyle(element).fontSize.split('px')[0] * 1;
+ const visible = (selector) => [...document.querySelectorAll(selector)].filter(e => e.getBoundingClientRect().width > 0);
+ const dialog = document.querySelector('dialog[open]');
+ checks.noHorizontalPageOverflow = document.documentElement.scrollWidth <= window.innerWidth + 1;
+ if (!dialog && visible('.dashboard-grid').length) {
+ checks.homeFitsViewport = document.documentElement.scrollHeight <= window.innerHeight + 1;
+ checks.macrosReadable = visible('.macro-label').every(e => font(e) >= 14);
+ const nav = document.querySelector('.bottom-nav').getBoundingClientRect();
+ checks.homeControlsAboveNavigation = visible('.mobile-journal-button').length > 0 && visible('.mobile-journal-button').every(e => e.getBoundingClientRect().bottom <= nav.top + 1);
+ checks.macrosAboveNavigation = visible('.macro-grid').every(e => e.getBoundingClientRect().bottom <= nav.top + 1);
+ const orb = document.querySelector('.orb').getBoundingClientRect();
+ checks.circleRemainsVisible = orb.width >= 100 && orb.height >= 100;
+ if (window.innerHeight > 500) {
+ const number = document.querySelector('.orb-number').getBoundingClientRect();
+ checks.circleAndReadoutDoNotOverlap = orb.bottom <= number.top + 1;
+ }
+ }
+ checks.navigationReadable = visible('.bottom-nav button span').every(e => font(e) >= 12);
+ checks.navigationTapTargets = visible('.bottom-nav button').every(e => e.getBoundingClientRect().height >= 44);
+ if (!dialog && visible('.settings-card .switch').length) {
+ checks.switchSize = visible('.switch').every(e => { const r=e.getBoundingClientRect(); return r.width >= 44 && r.height >= 28; });
+ checks.settingsLabelsReadable = visible('.toggle-label').every(e => font(e) >= 16);
+ }
+ if (dialog) {
+ checks.dialogFitsWidth = dialog.scrollWidth <= dialog.clientWidth + 1;
+ checks.nativeFieldsStayInColumns = visible('dialog input[type="date"], dialog input[type="time"]').every(e => e.getBoundingClientRect().right <= e.parentElement.getBoundingClientRect().right + 1);
+ checks.formLabelsReadable = visible('dialog label').every(e => font(e) >= 14);
+ checks.formControlsReadable = visible('dialog input:not([type="checkbox"]), dialog select').every(e => font(e) >= 16 && e.getBoundingClientRect().height >= 48);
+ }
+ const weightChart = visible('.weight-chart svg')[0];
+ if (weightChart) checks.weightChartTextNotShrunk = weightChart.getBoundingClientRect().width / (weightChart.getAttribute('viewBox').split(' ')[2] * 1) >= 0.9;
+ return {pass: Object.values(checks).every(Boolean), checks};
+})()