Fix complete rules of Cwda
[xogo.git] / common.css
CommitLineData
86f3c2cd
BA
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
8022d544
BA
14html {
15 height: 100%;
16}
41534b92 17body {
8022d544 18 height: 100%;
41534b92 19 margin: 0;
41534b92
BA
20 background-color: #f8f8f8;
21 font-family: Arial, Verdana, Tahoma, sans-serif;
8022d544
BA
22 /* https://stackoverflow.com/a/24392249/12660887 */
23 position: relative;
41534b92 24}
86f3c2cd
BA
25main {
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}
5abaabb3
BA
33h1 {
34 font-size: 2rem;
35 font-weight: bold;
36 text-align: center;
37 display: block;
38 margin: 10px 0;
39}
40h4 {
41 font-size: 1.5rem;
42 font-weight: bold;
43 text-align: center;
44 display: block;
45 margin: 10px 0;
46 color: darkgreen;
47}
48a {
49 text-decoration: none;
50}
51.bold {
52 font-weight: bold;
53}
54button {
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}
67button:hover, button.block-btn:hover {
68 background-color: #b11adc;
69}
70button.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}
77button.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}
98a.left-link {
99 margin-right: 25px;
100}
101a.right-link {
102 margin-left: 25px;
103}
104#footer a > img {
105 height: 1.2em;
106 display: inline-block;
107 transform: translateY(3px);
108}
86f3c2cd
BA
109
110main > div {
111 margin-top: 25vh;
112 min-height: 500px;
113 min-width: 320px;
65c770d1 114}
65c770d1
BA
115#gameInfos {
116 max-width: 800px;
86f3c2cd 117}
cc2c7183 118@media(max-height: 800px) {
af9c9be3 119 #newGameForm, #gameInfos {
86f3c2cd
BA
120 margin-top: 30px;
121 }
122}
cc2c7183
BA
123@media(max-width: 767px) {
124 main > div {
125 padding: 0 10px;
126 }
127}
86f3c2cd
BA
128#gameInfos,
129#boardContainer,
130#gameStopped,
131#pendingSeek,
132#pendingRematch,
133#newGameForm {
41534b92
BA
134 display: none;
135}
5abaabb3
BA
136#gameStopped > h1 {
137 margin-bottom: 10px;
86f3c2cd
BA
138}
139
140#gameInfos > .players-info {
141 text-align: center;
142}
86f3c2cd
BA
143#gameInfos > .options-info {
144 text-align: center;
145 color: #757575;
146 margin-bottom: 15px;
147}
86f3c2cd
BA
148#gameInfos > div {
149 margin: 10px 0;
150}
86f3c2cd
BA
151#gameInfos > .rules {
152 color: #732E6C;
153}
5abaabb3
BA
154#gameInfos > .rules p,
155#gameInfos > .rules ul,
156#gameInfos > .rules ol {
86f3c2cd
BA
157 margin: 10px 0;
158}
5abaabb3 159#gameInfos > .rules ul {
bc2bc396
BA
160 list-style-type: square;
161 padding-left: 30px;
162}
5abaabb3 163#gameInfos > .rules ol {
bc2bc396
BA
164 list-style-type: numeric;
165 padding-left: 30px;
166}
5abaabb3 167#gameInfos > .rules a {
fcede3ef
BA
168 padding-bottom: 1px;
169 border-bottom: 1px dotted black;
170}
5abaabb3
BA
171#gameInfos > .rules .author {
172 color: darkblue;
173 font-style: italic;
86f3c2cd
BA
174}
175
5abaabb3
BA
176/* Complete rules (separate page) */
177.full-rules {
178 max-width: 800px;
179 margin: 20px auto;
180 padding: 0 10px;
126ffc70
BA
181 overflow: auto;
182}
2c8375bb
BA
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}
126ffc70
BA
191.full-rules > div {
192 margin-bottom: 20px;
91339921 193}
549ca151 194.full-rules h1, .full-rules h2, .full-rules h3, .full-rules h4 {
5abaabb3
BA
195 font-weight: bold;
196 display: block;
86f3c2cd 197}
549ca151
BA
198.full-rules h1 {
199 font-size: 2.5em;
200 margin: 10px 0 20px 0;
201}
5abaabb3
BA
202.full-rules h2 {
203 color: darkred;
549ca151 204 font-size: 2em;
5abaabb3 205 margin: 10px 0;
86f3c2cd 206}
5abaabb3
BA
207.full-rules h3 {
208 color: darkviolet;
549ca151 209 font-size: 1.8em;
5abaabb3 210 margin: 10px 0;
41534b92 211}
5abaabb3
BA
212.full-rules h4 {
213 color: darkgreen;
214 font-size: 1.5em;
215 margin: 5px 0;
41534b92 216 text-align: center;
41534b92 217}
b2fc1259
BA
218piece.mark {
219 background-image: url('/pieces/mark.svg');
220}
221piece.mark.transparent {
222 opacity: 0.65;
223}
549ca151
BA
224.full-rules figure {
225 display: block;
226 overflow: visible;
227 margin-top: 20px;
228}
b2fc1259 229.full-rules figure::after {
549ca151
BA
230 content: '';
231 display: block;
232 clear: both;
233 margin-bottom: 20px;
234}
5abaabb3
BA
235.full-rules .diag {
236 position: relative;
549ca151
BA
237 margin: 0 auto;
238}
239.full-rules .left {
240 float: left;
241}
242.full-rules .right {
243 float: right;
41534b92 244}
2c8375bb
BA
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}
5abaabb3 255.full-rules figcaption {
3ec8a131 256 display: block;
5abaabb3 257 text-align: center;
549ca151
BA
258 clear: both;
259 font-size: 0.9em;
260 color: #0D1C46;
261 font-weight: bold;
41534b92 262}
5abaabb3
BA
263/* TODO: use same CSS for rules and full-rules? */
264.full-rules p, .full-rules ul, .full-rules ol {
265 margin: 10px 0;
41534b92 266}
5abaabb3
BA
267.full-rules ul {
268 list-style-type: square;
269 padding-left: 30px;
41534b92 270}
5abaabb3
BA
271.full-rules ol {
272 list-style-type: numeric;
273 padding-left: 30px;
41534b92
BA
274}
275
86f3c2cd
BA
276#ng-select {
277 margin-bottom: 20px;
41534b92 278}
41534b92 279/* Options when starting custom game */
86f3c2cd 280.words {
c7bf7b1b 281 line-height: 0.9em;
f8b43ef7 282 margin-top: 15px;
c7bf7b1b 283}
86f3c2cd
BA
284.words > .row {
285 margin: 0;
286}
287.words span {
41534b92
BA
288 cursor: pointer;
289 padding: 3px;
c7bf7b1b
BA
290 display: inline-block;
291 margin: 2px;
41534b92
BA
292}
293.highlight-word {
294 background-color: lightblue;
295}
86f3c2cd
BA
296#gameOptions {
297 text-align: center;
298}
535c464b 299.option-select, .option-input {
f8b43ef7
BA
300 margin: 15px 0 0 0;
301}
535c464b 302.option-input {
f8b43ef7
BA
303 display: inline-block;
304 margin-right: 10px;
86f3c2cd 305}
535c464b
BA
306.option-input input[type=number] {
307 width: 64px;
308}
86f3c2cd
BA
309.btn-wrap {
310 text-align: center;
311}
312
313#gameLink {
314 width: inherit;
315 text-align: center;
316}
41534b92 317/* Game link div + custom game "button" */
86f3c2cd
BA
318#gameLink span, #gameLink a, #footer a {
319 padding-bottom: 1px;
320 border-bottom: 1px dotted darkgrey;
321 color: darkred;
322}
86f3c2cd
BA
323#gameLink span {
324 display: inline-box;
41534b92
BA
325 cursor: pointer;
326}
86f3c2cd
BA
327#gameLink > p {
328 margin: 10px 0;
41534b92
BA
329}
330
5abaabb3
BA
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) */
3c61449b 368.chessboard {
41534b92
BA
369 position: absolute;
370 cursor: pointer;
41534b92 371}
41534b92
BA
372piece {
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}
c9ab0340
BA
381piece.hidden {
382 display: none;
383}
41534b92 384/* Drawing of the board */
3c61449b 385.chessboard_SVG {
41534b92
BA
386 width: 100%;
387 height: 100%;
388}
d621e620 389/* Default squares colors (can be overriden or unused) */
c7bf7b1b
BA
390.dark-square {
391 fill: #b58863;
392}
393.light-square {
394 fill: #f0d9b5;
395}
396.in-shadow {
397 filter: brightness(50%);
398}
41534b92
BA
399.reserves {
400 position: absolute;
401 display: block;
402 cursor: pointer;
403}
41534b92
BA
404.reserve-cell {
405 position: relative;
406 display: block;
407 float: left;
408}
41534b92
BA
409/* Pieces' counter for reserves */
410.reserve-num {
411 color: red;
412 position: absolute;
413 display: block;
414 font-weight: bold;
41534b92 415}
5abaabb3 416/* Choices div after a promotion */
41534b92
BA
417#choices, .choice {
418 position: absolute;
419 cursor: pointer;
420}
421
86f3c2cd
BA
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}
86f3c2cd
BA
428select {
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}
86f3c2cd
BA
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}
86f3c2cd
BA
460select, .select::after {
461 grid-area: select;
462}
86f3c2cd
BA
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}
86f3c2cd
BA
471select: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
86f3c2cd
BA
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
86f3c2cd
BA
545/* https://dev.to/kallmanation/styling-a-checkbox-with-only-css-3o3p */
546label.checkbox > input[type="checkbox"] {
547 display: none;
548}
549label.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}
86f3c2cd
BA
561label.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}
570label.checkbox > input[type="checkbox"]:checked + * {
571 color: teal;
572}
86f3c2cd
BA
573label.checkbox > span.spacer {
574 width: 10px;
575 content: " ";
576}
577
41534b92
BA
578/* https://theanam.github.io/css-only-loaders/ ("hour-glass") */
579:root{
580 --loader-width: 70px;
581 --loader-height: 70px;
86f3c2cd 582 --loader-color-primary: #01786F;
41534b92
BA
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}
41534b92
BA
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}
41534b92
BA
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}
41534b92
BA
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}
41534b92
BA
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}