-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.css
More file actions
227 lines (197 loc) · 5.45 KB
/
index.css
File metadata and controls
227 lines (197 loc) · 5.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/* ---------- index.css: Base layout and colors ----------
This CSS file controls overall layout, colors, and fonts.
Adjust colors and font-family as you like.
Avoid changing dimensions unless you know and test the layout effect.
NOTE: The game grid (canvas) background is PAINTED IN CODE, not by CSS.
To change canvas background color, edit the fill color
(look for ctx.fillStyle)
in:
- src/systems/renderer.ts (main game canvas)
- src/ui/hud.ts (Next preview canvas)
*/
/* ---------- Assign Some Color variables (tweak these) ---------- */
:root {
--page-bg: #505050; /* page background */
--page-text: #eeeeee; /* default text color */
--canvas-bg: #111111; /* used by JS fills in renderer/hud */
--canvas-border: #888888;
--grid-stroke: rgba(255, 255, 255, 0.06);
--panel-border: #333333;
--panel-bg: #6c6c6c; /* panel and footer background */
--accent: #dffdff; /* accent color (links, highlights) */
--footer-height: 36px; /* keep in sync with footer real height */
}
/* ---------- Base web page ---------- */
html,
body {
margin: 0; /* keep 0 for full-screen canvas */
background: var(--page-bg); /* page background color (safe to adjust) */
color: var(--page-text); /* default text color (safe to adjust for contrast) */
height: 100%;
font-family:
system-ui,
-apple-system,
Segoe UI,
Arial,
sans-serif;
}
/* Reserve space so the fixed footer doesn't cover content */
body,
main,
.wrap {
padding-bottom: calc(var(--footer-height) + env(safe-area-inset-bottom));
}
/* no page scrollbars by default */
body {
overflow: hidden;
}
/* Let MAIN be the scroll container only if needed. Use dynamic vh to avoid iOS bars. */
main {
height: calc(100dvh - var(--footer-height) - env(safe-area-inset-bottom));
overflow: auto; /* scroll only when content exceeds available height */
}
/* ---------- Main game area layout ----------
Avoid changing display or centering styles.
You can adjust gap (space between game and side panel).
*/
.wrap {
display: grid;
grid-template-rows: min-content max-content min-content; /* HUD, canvas, instructions */
align-content: center; /* pack rows together vertically */
justify-items: center; /* center horizontally */
gap: 24px;
min-height: 100vh; /* avoid hard 100vh + overlap; allow padding-bottom to matter */
}
/* ---------- Game board ----------
This is the main play area canvas.
Do not change width/height here - controlled by HTML attributes.
NOTE: The canvas background color is filled in JS.
Changing background here won't show unless you remove
the JS fill in src/systems/renderer.ts.
*/
canvas {
background: #444444; /* purely decorative since JS paints */
border: 1px solid var(--canvas-border); /* change game area border size, type, and color */
touch-action: none; /* help pointer events on mobile */
pointer-events: auto;
z-index: 5;
}
/* ---------- Small text (controls)----------
Used for control instructions.
You can change font-size or opacity for readability.
*/
.small {
font-size: 14px;
opacity: 0.9;
text-align: center;
z-index: 2;
}
/* ---------- Shared small button styling ---------- */
button.small {
appearance: none;
font: inherit;
font-weight: 600;
border-radius: 8px;
border: 1px solid var(--panel-border);
background: transparent;
color: var(--accent);
padding: 8px 14px;
min-height: 44px;
min-width: 88px;
cursor: pointer;
transition: background-color 0.2s ease;
}
/* Hover/focus: subtle filled look, strong focus outline */
button.small:hover {
background: #333333;
}
button.small:focus-visible {
outline: 2px solid #ffffff;
outline-offset: 2px;
}
/* keep a little breathing room around buttons */
#restart-btn,
#clear-data {
margin: 6px 0;
}
/* optional: make New Game a mild accent color fill */
#restart-btn {
background: var(--panel-bg);
border-color: var(--panel-border);
}
#restart-btn:hover {
background: #333333;
}
/* Clear High Score stays outline-only for hierarchy */
#clear-data {
background: transparent;
}
/* Active: tiny nudge without animation (no CLS, no perf hit) */
button.small:active {
transform: translateY(1px);
}
/* Disabled case (future-proof) */
button.small:disabled {
opacity: 0.6;
cursor: not-allowed;
}
/* ---------- Footer ---------- */
footer {
text-align: center;
font-size: 14px;
padding-bottom: env(safe-area-inset-bottom);
background: var(--panel-bg);
color: var(--page-text);
border-top: 1px solid var(--panel-border);
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: var(--footer-height);
width: 100%;
z-index: 3;
}
footer a {
margin: 0 4px;
color: var(--accent);
text-decoration: underline; /* underline by default */
font-weight: 600; /* mild weight cue */
}
footer a:hover {
text-decoration-thickness: 2px; /* stronger on hover/focus */
}
footer a:focus-visible {
outline: 2px solid #ffffff; /* accessible focus ring */
outline-offset: 2px;
border-radius: 2px;
}
/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
#clear-data {
transition: none;
}
}
/* on narrow devices, e.g.
an IPhone SE only 375 pixels wide
shrink the canvas to fit.
*/
@media (max-width: 400px) {
canvas {
width: 90vw;
height: auto;
}
}
/* on short devices (height < 700px)
shrink spacing to fit.
*/
@media (max-height: 700px) {
.wrap {
gap: 6px;
}
#hud {
font-size: 14px;
}
.small {
font-size: 13px;
}
}