Repository navigation
Expand file tree
/
Copy pathstyle.css
More file actions
249 lines (219 loc) · 7.23 KB
/
Copy pathstyle.css
File metadata and controls
249 lines (219 loc) · 7.23 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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/**
* @file style.css
* @description The primary stylesheet for the Checkers Web Application.
* This file defines the visual design system, layout structure, and component styling.
* It utilizes modern CSS3 techniques including CSS Custom Properties (Variables),
* CSS Grid for the board layout, and Flexbox for UI alignment.
*
* Key Visual Features:
* - Realistic design with realistic wood and felt textures.
* - Responsive layout for various screen sizes.
* - 3D effects for game pieces using box-shadows.
* - Dynamic overlays for game states.
*
* @author John S. Garvey
* @date January 2026
*/
/* -------------------------------------------------------------------------- */
/* 1. Variables */
/* -------------------------------------------------------------------------- */
/**
* CSS Custom Properties (Variables)
* Defines the global design tokens for colors, dimensions, and typography.
* These variables allow for easy theming and consistent styling across the app.
*/
:root {
/* --- Color Palette: Backgrounds --- */
--app-background-color: #1e4d2b;
/* --- Color Palette: Game Board --- */
--board-frame-color: #8B4513; /* SaddleBrown */
--board-border-color: #A0522D; /* Sienna */
--square-color-light: #006400; /* DarkGreen */
--square-color-dark: #F5DEB3; /* Wheat */
/* --- Color Palette: Game Pieces --- */
--piece-color-black: #333333;
--piece-color-red: #ff0000;
/* --- Color Palette: UI & Text --- */
--text-color-primary: #ffffff;
--text-color-highlight: #ffc107;
--selection-color: #ffff00;
--shadow-color: rgba(0, 0, 0, 0.5);
--overlay-color: rgba(0, 0, 0, 0.5);
/* --- Dimensions & Layout --- */
--grid-column-count: 8;
--board-square-size: 50px;
--game-piece-size: 40px;
/* --- Typography --- */
--font-family-body: sans-serif;
--font-family-display: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
/* -------------------------------------------------------------------------- */
/* 2. Global Layout */
/* -------------------------------------------------------------------------- */
/**
* Body Layout
* Sets up the main viewport container with a flex column layout to center content.
* Applies a complex background gradient to simulate a felt texture.
*/
body {
font-family: var(--font-family-body);
display: flex;
flex-direction: column;
align-items: center;
/* Background: Radial gradient for lighting + Repeating linear gradient for texture */
background-color: var(--app-background-color);
background-image: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.4) 100%),
repeating-linear-gradient(45deg, rgba(0,0,0,0.03) 0px, rgba(0,0,0,0.03) 2px, transparent 2px, transparent 4px);
min-height: 100vh;
margin: 0;
}
/* -------------------------------------------------------------------------- */
/* 3. Game Board */
/* -------------------------------------------------------------------------- */
/**
* Board Frame
* The outer container for the game board, styled to look like a wooden frame.
* Uses box-shadows to create depth and a beveled edge effect.
*/
#board-frame {
background-color: var(--board-frame-color);
padding: 20px;
border-radius: 10px;
box-shadow: 10px 10px 20px var(--shadow-color), inset 0 0 10px var(--shadow-color);
border: 5px solid var(--board-border-color);
}
/**
* Board Grid
* The 8x8 playing surface. Uses CSS Grid Layout for precise square positioning.
*/
#board {
display: grid;
grid-template-columns: repeat(var(--grid-column-count), var(--board-square-size));
grid-template-rows: repeat(var(--grid-column-count), var(--board-square-size));
border: 2px solid var(--piece-color-black);
}
/**
* Board Squares
* Individual cells of the grid.
*/
.square {
width: var(--board-square-size);
height: var(--board-square-size);
}
/* Alternating square colors */
.light {
background-color: var(--square-color-light);
}
.dark {
background-color: var(--square-color-dark);
}
/* -------------------------------------------------------------------------- */
/* 4. Game Pieces */
/* -------------------------------------------------------------------------- */
/**
* Base Piece Style
* Represents a checker piece. Uses border-radius for the circular shape and
* multiple box-shadows to create a 3D, beveled appearance.
* Flexbox is used to center the 'K' symbol for Kings.
*/
.piece {
width: var(--game-piece-size);
height: var(--game-piece-size);
border-radius: 50%;
margin: 5px;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
font-size: 20px;
color: var(--text-color-primary);
/* 3D Bevel Effect */
box-shadow:
inset 0 0 0 2px rgba(0,0,0,0.2),
inset 0 0 0 5px rgba(255,255,255,0.1),
inset 0 0 0 6px rgba(0,0,0,0.2),
0 2px 2px rgba(0,0,0,0.2);
}
/* Piece Variants */
.red {
background-color: var(--piece-color-red);
}
.black {
background-color: var(--piece-color-black);
}
/**
* King Modifier
* Adds a visual indicator (letter 'K') to promoted pieces.
*/
.king::after {
content: 'K';
}
/**
* Selection State
* Highlights the currently selected piece with a distinct border.
*/
.selected {
border: 2px solid var(--selection-color);
}
/* -------------------------------------------------------------------------- */
/* 5. User Interface */
/* -------------------------------------------------------------------------- */
/**
* Main Title
* Styled with a metallic gradient fill and drop shadow for a premium look.
*/
h1 {
font-family: var(--font-family-display);
font-size: 3rem;
font-weight: 900;
text-transform: uppercase;
letter-spacing: 8px;
color: var(--text-color-primary);
/* Metallic Text Gradient */
background: linear-gradient(to bottom, #ffffff 0%, #bfbfbf 100%);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
filter: drop-shadow(0 4px 6px var(--shadow-color));
margin: 50px 0 40px 0;
text-align: center;
}
/**
* Winner Overlay
* A full-screen modal overlay displayed when the game ends.
*/
#winner-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2000;
background-color: var(--overlay-color);
display: flex;
justify-content: center;
align-items: center;
}
/**
* Winner Message Text
* Large, highlighted text to announce the winner.
*/
#winner-message {
font-size: 50px;
font-weight: bold;
color: var(--text-color-highlight);
text-shadow: 2px 2px 4px #000000;
}
/**
* Status Indicator
* Displays the current turn or game status.
* Styled to match the board frame aesthetics.
*/
.status-indicator {
background-color: var(--board-frame-color);
border: 2px solid var(--board-border-color);
border-radius: 5px;
color: var(--text-color-primary);
font-size: 18px;
text-align: center;
}