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