Skip to content
Source
Sign inSign up
samwillis/one-million-boxes
Open History to see the last commit

mobile.css

131 lines3.1 KB

1/**
2 * Mobile-specific styles for 1 Million Boxes
3 *
4 * This file contains GLOBAL mobile behaviors only:
5 * - Safe area insets for notched devices
6 * - Touch interaction behaviors
7 * - Hover/pointer media queries
8 * - Reduced motion preferences
9 * - High DPI adjustments
10 *
11 * Component-specific mobile styles live in each component's CSS file.
12 * Responsive variable overrides are in global.css.
13 */
14​
15/* ============================================
16 Safe Area Insets (notched devices)
17 ============================================ */
18@supports (padding: max(0px)) {
19 .game-layout {
20 padding-top: env(safe-area-inset-top);
21 padding-bottom: env(safe-area-inset-bottom);
22 padding-left: env(safe-area-inset-left);
23 padding-right: env(safe-area-inset-right);
24 }
25​
26 .header {
27 padding-left: max(12px, env(safe-area-inset-left));
28 padding-right: max(12px, env(safe-area-inset-right));
29 }
30​
31 .world-view-wrapper {
32 right: max(var(--minimap-margin), env(safe-area-inset-right));
33 }
35​
36/* ============================================
37 Touch-Specific Styles
38 ============================================ */
39​
40/* Prevent text selection on interactive elements */
41.game-canvas-container,
42.game-canvas,
43.zoom-controls,
44.world-view-container {
45 -webkit-user-select: none;
46 user-select: none;
47 -webkit-touch-callout: none;
49​
50/* Prevent pull-to-refresh on the game area */
51.game-main {
52 overscroll-behavior: none;
54​
55.game-layout {
56 overscroll-behavior: contain;
58​
59/* Touch target minimum size enforcement */
60@media (pointer: coarse) {
61 button,
62 [role="button"],
63 .clickable {
64 min-width: var(--touch-min);
65 min-height: var(--touch-min);
66 }
67​
68 /* Active state feedback for touch */
69 button:active:not(:disabled),
70 [role="button"]:active {
71 transform: scale(0.95);
72 transition: transform 0.1s ease;
73 }
75​
76/* ============================================
77 Hover States (pointer devices only)
78 ============================================ */
79@media (hover: hover) and (pointer: fine) {
80 .world-view-wrapper:hover .world-view-container {
81 transform: scale(1.05);
82 }
84​
85/* Disable hover effects on touch devices */
86@media (hover: none) {
87 .hover-hint {
88 display: none;
89 }
90​
91 .world-view-wrapper:hover .world-view-container {
92 transform: none;
93 }
95​
96/* ============================================
97 Reduced Motion Preference
98 ============================================ */
99@media (prefers-reduced-motion: reduce) {
100 *,
101 *::before,
102 *::after {
103 animation-duration: 0.01ms !important;
104 animation-iteration-count: 1 !important;
105 transition-duration: 0.01ms !important;
106 }
107​
108 .touch-ripple {
109 display: none;
110 }
112​
113/* ============================================
114 Landscape Phone Adjustments
115 ============================================ */
116@media (max-height: 480px) and (orientation: landscape) {
117 :root {
118 --header-height: 32px;
119 --bottom-controls-height: 44px;
120 --bottom-dial-size: 44px;
121 --minimap-size: 80px;
122 --minimap-margin: 4px;
123 }
124​
125 /* Hide minimap in very cramped landscape */
126 @media (max-height: 360px) {
127 .world-view-wrapper {
128 display: none;
129 }
130 }