Doublemove ok. Still some random issues with animation
[xogo.git] / common.css
1 /* CSS reset */
2 *,
3 *::before,
4 *::after {
5 box-sizing: border-box;
6 margin: 0;
7 padding: 0;
8 border: 0;
9 font-size: 100%;
10 font: inherit;
11 vertical-align: baseline;
12 }
13
14 html {
15 height: 100%;
16 }
17
18 body {
19 height: 100%;
20 margin: 0;
21 background-color: #f8f8f8;
22 font-family: Arial, Verdana, Tahoma, sans-serif;
23 /* https://stackoverflow.com/a/24392249/12660887 */
24 position: relative;
25 }
26
27 main {
28 display: flex;
29 flex-direction: column;
30 justify-content: center;
31 align-items: center;
32 flex-wrap: nowrap;
33 font-size: 1.25rem;
34 }
35
36 main > div {
37 margin-top: 25vh;
38 min-height: 500px;
39 min-width: 320px;
40 max-width: 800px; /*useful for rules display only*/
41 }
42
43 @media(max-height: 800px) {
44 main > div {
45 margin-top: 30px;
46 }
47 }
48
49 @media(max-width: 767px) {
50 main > div {
51 padding: 0 10px;
52 }
53 }
54
55 .author {
56 color: darkblue;
57 font-style: italic;
58 }
59
60 #boardContainer {
61 margin: 0;
62 padding: 0;
63 border: none;
64 }
65
66 h1 {
67 font-size: 2rem;
68 font-weight: bold;
69 text-align: center;
70 display: block;
71 margin: 10px 0;
72 }
73
74 h4 {
75 font-size: 1.5rem;
76 font-weight: bold;
77 text-align: center;
78 display: block;
79 margin: 10px 0;
80 color: darkgreen;
81 }
82
83 #gameInfos,
84 #boardContainer,
85 #gameStopped,
86 #pendingSeek,
87 #pendingRematch,
88 #newGameForm {
89 display: none;
90 }
91
92 .bold {
93 font-weight: bold;
94 }
95
96 #gameInfos > .players-info {
97 text-align: center;
98 }
99
100 #gameInfos > .options-info {
101 text-align: center;
102 color: #757575;
103 margin-bottom: 15px;
104 }
105
106 #gameInfos > div {
107 margin: 10px 0;
108 }
109
110 #gameInfos > .rules {
111 color: #732E6C;
112 }
113
114 #gameInfos > .rules > p,
115 #gameInfos > .rules > ul,
116 #gameInfos > .rules > ol {
117 margin: 10px 0;
118 }
119
120 #gameStopped > h1 {
121 margin-bottom: 10px;
122 }
123
124 /* "Sticky footer" */
125 #footer {
126 position: absolute;
127 bottom: 0;
128 left: 0;
129 right: 0;
130 height: 50px;
131 text-align: center;
132 }
133
134 a.left-link {
135 margin-right: 25px;
136 }
137 a.right-link {
138 margin-left: 25px;
139 }
140
141 #footer a > img {
142 height: 1.2em;
143 display: inline-block;
144 transform: translateY(3px);
145 }
146
147 button {
148 background-color: #757575;
149 border: none;
150 color: white;
151 padding: 10px 15px;
152 text-align: center;
153 text-decoration: none;
154 display: inline-block;
155 font-size: 1em;
156 cursor: pointer;
157 border-radius: 20%;
158 margin: 15px 0;
159 }
160
161 button:hover, button.block-btn:hover {
162 background-color: #b11adc;
163 }
164
165 button.block-btn {
166 display: block;
167 background-color: #01786F;
168 margin: 0 auto 30px auto; /*TODO: margin-bottom 20px ? */
169 font-size: 2rem;
170 padding: 15px 32px;
171 }
172
173 button.cancel-something {
174 background-color: darkred;
175 display: block;
176 margin-left: auto;
177 margin-right: auto;
178 }
179
180 #upLeftInfos {
181 position: absolute;
182 left: 0;
183 top: 0;
184 }
185
186 #upRightStop {
187 position: absolute;
188 left: calc(100% - 25px);
189 top: 0;
190 }
191 #upLeftInfos > svg, #upRightStop > svg {
192 width: 25px;
193 cursor: pointer;
194 }
195
196 @media(max-width: 767px) {
197 #upRightStop {
198 left: calc(100% - 35px);
199 }
200 #upLeftInfos > svg, #upRightStop > svg {
201 width: 35px;
202 }
203 #upLeftInfos > svg path, #upRightStop > svg path {
204 fill: #999;
205 }
206 }
207
208 #ng-select {
209 margin-bottom: 20px;
210 }
211
212 /* Options when starting custom game */
213 .words {
214 line-height: 0.9em;
215 margin-top: 15px;
216 }
217 .words > .row {
218 margin: 0;
219 }
220 .words span {
221 cursor: pointer;
222 padding: 3px;
223 display: inline-block;
224 margin: 2px;
225 }
226 .highlight-word {
227 background-color: lightblue;
228 }
229
230 #gameOptions {
231 text-align: center;
232 }
233
234 .option-select, .option-check {
235 margin: 15px 0 0 0;
236 }
237
238 .option-check {
239 display: inline-block;
240 margin-right: 10px;
241 }
242
243 .btn-wrap {
244 text-align: center;
245 }
246
247 #gameLink {
248 width: inherit;
249 text-align: center;
250 }
251
252 a {
253 text-decoration: none;
254 }
255
256 /* Game link div + custom game "button" */
257 #gameLink span, #gameLink a, #footer a {
258 padding-bottom: 1px;
259 border-bottom: 1px dotted darkgrey;
260 color: darkred;
261 }
262
263 #gameLink span {
264 display: inline-box;
265 cursor: pointer;
266 }
267
268 #gameLink > p {
269 margin: 10px 0;
270 }
271
272 /* Board container (without reserves) */
273 .chessboard {
274 position: absolute;
275 cursor: pointer;
276 }
277
278 /* Board container can be resized */
279 .resizeable {
280 resize: both;
281 overflow: hidden;
282 min-width: 200px;
283 min-height: 200px;
284 }
285
286 piece {
287 position: absolute;
288 top: 0;
289 left: 0;
290 background-size: cover;
291 z-index: 2;
292 will-change: transform;
293 pointer-events: none;
294 }
295
296 /* Drawing of the board */
297 .chessboard_SVG {
298 width: 100%;
299 height: 100%;
300 }
301
302 .dark-square {
303 fill: #b58863;
304 }
305 .light-square {
306 fill: #f0d9b5;
307 }
308 .in-shadow {
309 filter: brightness(50%);
310 }
311
312 .reserves {
313 position: absolute;
314 display: block;
315 cursor: pointer;
316 }
317
318 .reserve-cell {
319 position: relative;
320 display: block;
321 float: left;
322 }
323
324 /* Pieces' counter for reserves */
325 .reserve-num {
326 color: red;
327 position: absolute;
328 display: block;
329 font-weight: bold;
330 /*z-index: 10;*/
331 }
332
333 /* Choices div after a promotion (TODO: do not hide board) */
334 #choices, .choice {
335 position: absolute;
336 cursor: pointer;
337 }
338
339
340 /* https://moderncss.dev/custom-select-styles-with-pure-css/ */
341 :root {
342 --select-border: #777;
343 --select-focus: #b11adc;
344 --select-arrow: var(--select-border);
345 }
346
347 select {
348 appearance: none;
349 background-color: transparent;
350 border: none;
351 padding: 0 1em 0 0;
352 margin: 0;
353 width: 100%;
354 font-family: inherit;
355 font-size: inherit;
356 cursor: inherit;
357 line-height: inherit;
358 z-index: 1;
359 outline: none;
360 }
361
362 .select {
363 display: grid;
364 grid-template-areas: "select";
365 align-items: center;
366 position: relative;
367 min-width: 15ch;
368 max-width: 30ch;
369 border: 1px solid var(--select-border);
370 border-radius: 0.25em;
371 padding: 0.25em 0.5em;
372 font-size: 1.25rem;
373 cursor: pointer;
374 line-height: 1.1;
375 background-color: #fff;
376 background-image: linear-gradient(to top, #f9f9f9, #fff 33%);
377 width: 100%;
378 margin: auto;
379 }
380
381 select, .select::after {
382 grid-area: select;
383 }
384
385 .select::after {
386 content: "";
387 justify-self: end;
388 width: 0.8em;
389 height: 0.5em;
390 background-color: var(--select-arrow);
391 clip-path: polygon(100% 0%, 0 0%, 50% 100%);
392 }
393
394 select:focus + .focus {
395 position: absolute;
396 top: -1px;
397 left: -1px;
398 right: -1px;
399 bottom: -1px;
400 border: 2px solid var(--select-focus);
401 border-radius: inherit;
402 }
403
404
405 /* https://auralinna.blog/post/2018/how-to-create-material-design-like-form-text-fields/ */
406 .form-field {
407 display: block;
408 margin-bottom: 16px;
409 }
410 .form-field--is-active .form-field__control::after {
411 border-bottom: 2px solid #b11adc;
412 transform: scaleX(150);
413 }
414 .form-field--is-active .form-field__label {
415 color: #b11adc;
416 font-size: 0.75rem;
417 transform: translateY(-14px);
418 }
419 .form-field--is-filled .form-field__label {
420 font-size: 0.75rem;
421 transform: translateY(-14px);
422 }
423 .form-field__label {
424 display: block;
425 font-size: 1.2rem;
426 font-weight: normal;
427 left: 0;
428 margin: 0;
429 padding: 18px 12px 0;
430 position: absolute;
431 top: 0;
432 transition: all 0.4s;
433 width: 100%;
434 }
435 .form-field__control {
436 background: #eee;
437 border-radius: 8px 8px 0 0;
438 overflow: hidden;
439 position: relative;
440 width: 100%;
441 }
442 .form-field__control::after {
443 border-bottom: 2px solid #b11adc;
444 bottom: 0;
445 content: "";
446 display: block;
447 left: 0;
448 margin: 0 auto;
449 position: absolute;
450 right: 0;
451 transform: scaleX(0);
452 transition: all 0.4s;
453 width: 1%;
454 }
455 .form-field__input {
456 appearance: none;
457 background: transparent;
458 border: 0;
459 border-bottom: 1px solid #999;
460 color: #333;
461 display: block;
462 font-size: 1.2rem;
463 margin-top: 24px;
464 outline: 0;
465 padding: 0 12px 10px 12px;
466 width: 100%;
467 }
468
469
470 /* https://dev.to/kallmanation/styling-a-checkbox-with-only-css-3o3p */
471 label.checkbox > input[type="checkbox"] {
472 display: none;
473 }
474 label.checkbox > input[type="checkbox"] + *::before {
475 content: "";
476 display: inline-block;
477 vertical-align: bottom;
478 margin-bottom: 3px;
479 width: 1.1rem;
480 height: 1.1rem;
481 border-radius: 10%;
482 border-style: solid;
483 border-width: 0.1rem;
484 border-color: gray;
485 }
486
487 label.checkbox > input[type="checkbox"]:checked + *::before {
488 content: "✓";
489 font-size: 1.1rem;
490 /*padding:10px;*/
491 color: white;
492 text-align: center;
493 background: teal;
494 border-color: teal;
495 }
496 label.checkbox > input[type="checkbox"]:checked + * {
497 color: teal;
498 }
499
500 /*label.checkbox {
501 color: teal;
502 }*/
503 label.checkbox > span.spacer {
504 width: 10px;
505 content: " ";
506 }
507
508
509 /* https://theanam.github.io/css-only-loaders/ ("hour-glass") */
510 :root{
511 --loader-width: 70px;
512 --loader-height: 70px;
513 --loader-color-primary: #01786F;
514 --loader-color-secondary: #EEE;
515 --line-width: 3px;
516 --animation-duration: 3s;
517 --loader-initial-scale: 0.1;
518 }
519 .loader,.loader:before,.loader:after{
520 box-sizing: border-box;
521 flex-grow: 0;
522 flex-shrink: 0;
523 }
524
525 @keyframes slide {
526 0% {
527 transform: translateY(0%);
528 }
529 25% {
530 transform: translateY(100%);
531 }
532 50% {
533 transform: translateY(100%);
534 }
535 75% {
536 transform: translateY(0%);
537 }
538 100% {
539 transform: translateY(0%);
540 }
541 }
542
543 @keyframes spin {
544 0% {
545 transform: rotate(0deg);
546 }
547 25% {
548 transform: rotate(0deg);
549 }
550 50% {
551 transform: rotate(180deg);
552 }
553 75% {
554 transform: rotate(180deg);
555 }
556 100% {
557 transform: rotate(360deg);
558 }
559 }
560
561 .loader.hour-glass {
562 position: relative;
563 width: var(--loader-width, 100px);
564 height: var(--loader-height, 100px);
565 background-color: var(--loader-color-primary, #00f);
566 -webkit-clip-path: polygon(0% 0%, 100% 0%, 50% 50%, 100% 100%, 0% 100%, 50% 50%);
567 clip-path: polygon(0% 0%, 100% 0%, 50% 50%, 100% 100%, 0% 100%, 50% 50%);
568 overflow: hidden;
569 animation: spin var(--animation-duration, 4s) infinite ease-in-out;
570 margin: 20px auto;
571 }
572
573 .hour-glass:before {
574 content: "";
575 position: absolute;
576 top: 0px;
577 left: 0px;
578 width: var(--loader-width, 100px);
579 height: 50%;
580 background-color: var(--loader-color-secondary, #eee);
581 animation: slide var(--animation-duration, 4s) infinite ease-in-out;
582 }