diff --git a/src/App.css b/src/App.css index 47e1678..d647ae7 100644 --- a/src/App.css +++ b/src/App.css @@ -35,7 +35,10 @@ align-items: center; flex: 1; width: 100%; + max-width: 100vw; + overflow: hidden; box-sizing: border-box; + padding: 0 20px; } /* Digital clock style (default) */ @@ -46,6 +49,8 @@ text-shadow: 0 0 20px rgba(255, 255, 255, 0.5); letter-spacing: 0.05em; white-space: nowrap; + max-width: 100%; + overflow: hidden; } .style-button { diff --git a/src/App.tsx b/src/App.tsx index 85e5d6f..32dd69e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,18 +6,14 @@ import './App.css' type ClockStyle = 'digital' | 'flip' | 'roll' function DigitalClock({ time, size }: { time: string; size: number }) { - // Match width with flip/roll clocks - // Total flip/roll width ≈ 5.1 * (size / 1.6) because size is now scaled - // Actually size passed in is already the final size - // Flip: 6 * (size * 0.75) + 2 * (size * 0.3) = 4.5 * size + 0.6 * size = 5.1 * size - // Digital: 8 chars, each char ≈ fontSize * 0.6 wide in monospace = 4.8 * fontSize - // To match: 4.8 * fontSize = 5.1 * size => fontSize = size * 1.06 - const fontSize = Math.floor(size * 1.06) + // Match visual height with flip/roll clocks + // Use slightly smaller than size to prevent overflow, but keep height similar + const fontSize = Math.floor(size * 0.95) return (