Some fixes
[vchess.git] / client / src / components / BaseGame.vue
CommitLineData
a6088c90 1<template lang="pug">
e71161fb 2div#baseGame
7e355d68 3 input#modalEog.modal(type="checkbox")
6808d7a1
BA
4 div#eogDiv(
5 role="dialog"
6 data-checkbox="modalEog"
7 )
9a3049f3 8 .card.text-center
7e355d68 9 label.modal-close(for="modalEog")
9a3049f3 10 h3.section {{ endgameMessage }}
cf94b843
BA
11 #gameContainer
12 #boardContainer
6808d7a1 13 Board(
a6836242 14 ref="board"
6808d7a1
BA
15 :vr="vr"
16 :last-move="lastMove"
20620465
BA
17 :analyze="game.mode=='analyze'"
18 :score="game.score"
6808d7a1
BA
19 :user-color="game.mycolor"
20 :orientation="orientation"
21 :vname="game.vname"
22 :incheck="incheck"
23 @play-move="play"
24 )
20620465 25 #turnIndicator(v-if="showTurn") {{ turn }}
b1e46b33 26 #controls.button-group
b9a5fe01
BA
27 button(@click="gotoBegin()")
28 img.inline(src="/images/icons/fast-forward_rev.svg")
29 button(@click="undo()")
30 img.inline(src="/images/icons/play_rev.svg")
31 button(v-if="canFlip" @click="flip()")
32 img.inline(src="/images/icons/flip.svg")
54ec15eb
BA
33 button(
34 @click="runAutoplay()"
35 :class="{'in-autoplay': autoplay}"
36 )
37 img.inline(src="/images/icons/autoplay.svg")
b9a5fe01
BA
38 button(@click="play()")
39 img.inline(src="/images/icons/play.svg")
40 button(@click="gotoEnd()")
41 img.inline(src="/images/icons/fast-forward.svg")
cf94b843 42 #movesList
6808d7a1 43 MoveList(
933fd1f9 44 :show="showMoves"
feaf1bf7
BA
45 :canAnalyze="canAnalyze"
46 :canDownload="allowDownloadPGN"
6808d7a1
BA
47 :score="game.score"
48 :message="game.scoreMsg"
49 :firstNum="firstMoveNumber"
50 :moves="moves"
51 :cursor="cursor"
feaf1bf7
BA
52 @download="download"
53 @showrules="showRules"
54 @analyze="analyzePosition"
6808d7a1
BA
55 @goto-move="gotoMove"
56 )
41c80bb6 57 .clearer
a6088c90
BA
58</template>
59
60<script>
61import Board from "@/components/Board.vue";
f21cd6d9 62import MoveList from "@/components/MoveList.vue";
a6088c90
BA
63import { store } from "@/store";
64import { getSquareId } from "@/utils/squareId";
d4036efe 65import { getDate } from "@/utils/datetime";
602d6bef 66import { processModalClick } from "@/utils/modalClick";
77c50966 67import { getScoreMessage } from "@/utils/scoring";
e71161fb
BA
68import { getFullNotation } from "@/utils/notation";
69import { undoMove } from "@/utils/playUndo";
a6088c90 70export default {
6808d7a1 71 name: "my-base-game",
a6088c90
BA
72 components: {
73 Board,
6808d7a1 74 MoveList
a6088c90 75 },
e71161fb 76 props: ["game"],
a6088c90
BA
77 data: function() {
78 return {
79 st: store.state,
b7c32f1a 80 // NOTE: all following variables must be reset at the beginning of a game
e71161fb 81 vr: null, //VariantRules object, game state
a6088c90
BA
82 endgameMessage: "",
83 orientation: "w",
84 score: "*", //'*' means 'unfinished'
b7c32f1a 85 moves: [],
a6088c90
BA
86 cursor: -1, //index of the move just played
87 lastMove: null,
5157ce0b 88 firstMoveNumber: 0, //for printing
e71161fb 89 incheck: [], //for Board
57eb158f 90 inMultimove: false,
54ec15eb
BA
91 autoplay: false,
92 autoplayLoop: null,
57eb158f
BA
93 inPlay: false,
94 stackToPlay: []
a6088c90
BA
95 };
96 },
97 computed: {
6b9378a6
BA
98 turn: function() {
99 if (!this.vr) return "";
100 if (this.vr.showMoves != "all") {
101 return this.st.tr[
102 (this.vr.turn == 'w' ? "White" : "Black") + " to move"];
103 }
104 // Cannot flip: racing king or circular chess
105 return (
106 this.vr.movesCount == 0 && this.game.mycolor == "w"
107 ? this.st.tr["It's your turn!"]
108 : ""
109 );
110 },
111 // TODO: is it OK to pass "computed" as propoerties?
112 // Also, some are seemingly not recomputed when vr is initialized.
a6088c90 113 showMoves: function() {
933fd1f9
BA
114 return this.game.score != "*"
115 ? "all"
6b9378a6 116 : (!!this.vr ? this.vr.showMoves : "none");
20620465
BA
117 },
118 showTurn: function() {
71ef1664
BA
119 return (
120 this.game.score == '*' &&
6b9378a6 121 !!this.vr && (this.vr.showMoves != "all" || !this.vr.canFlip)
71ef1664 122 );
a6088c90 123 },
20620465 124 canAnalyze: function() {
6b9378a6
BA
125 return (
126 this.game.mode != "analyze" &&
127 !!this.vr && this.vr.canAnalyze
128 );
20620465 129 },
71ef1664 130 canFlip: function() {
6b9378a6 131 return !!this.vr && this.vr.canFlip;
71ef1664 132 },
20620465 133 allowDownloadPGN: function() {
6b9378a6
BA
134 return (
135 this.game.score != "*" ||
136 (!!this.vr && this.vr.showMoves == "all")
137 );
6808d7a1 138 }
a6088c90 139 },
4b0384fa 140 created: function() {
b1e46b33 141 if (!!this.game.fenStart) this.re_setVariables();
4b0384fa 142 },
cf94b843 143 mounted: function() {
e71161fb
BA
144 if (!("ontouchstart" in window)) {
145 // Desktop browser:
146 const baseGameDiv = document.getElementById("baseGame");
147 baseGameDiv.tabIndex = 0;
148 baseGameDiv.addEventListener("click", this.focusBg);
149 baseGameDiv.addEventListener("keydown", this.handleKeys);
150 baseGameDiv.addEventListener("wheel", this.handleScroll);
151 }
42a92848
BA
152 document.getElementById("eogDiv")
153 .addEventListener("click", processModalClick);
cf94b843 154 },
54ec15eb
BA
155 beforeDestroy: function() {
156 if (!!this.autoplayLoop) clearInterval(this.autoplayLoop);
157 },
a6088c90 158 methods: {
9ca1e26b 159 focusBg: function() {
9ca1e26b
BA
160 document.getElementById("baseGame").focus();
161 },
162 handleKeys: function(e) {
6808d7a1
BA
163 if ([32, 37, 38, 39, 40].includes(e.keyCode)) e.preventDefault();
164 switch (e.keyCode) {
9ca1e26b
BA
165 case 37:
166 this.undo();
167 break;
168 case 39:
169 this.play();
170 break;
5701c228 171 case 38:
9ca1e26b
BA
172 this.gotoBegin();
173 break;
174 case 40:
175 this.gotoEnd();
176 break;
177 case 32:
9ca1e26b
BA
178 this.flip();
179 break;
180 }
181 },
dcd68c41 182 handleScroll: function(e) {
e71161fb
BA
183 e.preventDefault();
184 if (e.deltaY < 0) this.undo();
185 else if (e.deltaY > 0) this.play();
dcd68c41 186 },
0e16cb26
BA
187 showRules: function() {
188 //this.$router.push("/variants/" + this.game.vname);
189 window.open("#/variants/" + this.game.vname, "_blank"); //better
190 },
b1e46b33
BA
191 re_setVariables: function(game) {
192 if (!game) game = this.game; //in case of...
4b0384fa 193 this.endgameMessage = "";
8477e53d 194 // "w": default orientation for observed games
b1e46b33
BA
195 this.orientation = game.mycolor || "w";
196 this.moves = JSON.parse(JSON.stringify(game.moves || []));
e71161fb 197 // Post-processing: decorate each move with notation and FEN
b1e46b33
BA
198 this.vr = new V(game.fenStart);
199 const parsedFen = V.ParseFen(game.fenStart);
8477e53d
BA
200 const firstMoveColor = parsedFen.turn;
201 this.firstMoveNumber = Math.floor(parsedFen.movesCount / 2);
f54f4c26 202 let L = this.moves.length;
d4036efe 203 this.moves.forEach(move => {
e71161fb
BA
204 // Strategy working also for multi-moves:
205 if (!Array.isArray(move)) move = [move];
f54f4c26 206 move.forEach((m,idx) => {
e71161fb
BA
207 m.notation = this.vr.getNotation(m);
208 this.vr.play(m);
f54f4c26
BA
209 if (idx < L - 1 && this.vr.getCheckSquares(this.vr.turn).length > 0)
210 m.notation += "+";
e71161fb 211 });
d4036efe 212 });
8477e53d 213 if (firstMoveColor == "b") {
311cba76 214 // 'start' & 'end' is required for Board component
6808d7a1 215 this.moves.unshift({
6808d7a1 216 notation: "...",
311cba76 217 start: { x: -1, y: -1 },
3a2a7b5f
BA
218 end: { x: -1, y: -1 },
219 fen: game.fenStart
6808d7a1 220 });
f54f4c26 221 L++;
697ee580 222 }
e71161fb 223 this.positionCursorTo(this.moves.length - 1);
9ef63965 224 this.incheck = this.vr.getCheckSquares(this.vr.turn);
f54f4c26 225 const score = this.vr.getCurrentScore();
3f22c2c3
BA
226 if (L > 0 && this.moves[L - 1].notation != "...") {
227 if (["1-0","0-1"].includes(score))
228 this.moves[L - 1].notation += "#";
229 else if (this.vr.getCheckSquares(this.vr.turn).length > 0)
230 this.moves[L - 1].notation += "+";
231 }
4b0384fa 232 },
e71161fb
BA
233 positionCursorTo: function(index) {
234 this.cursor = index;
235 // Caution: last move in moves array might be a multi-move
236 if (index >= 0) {
237 if (Array.isArray(this.moves[index])) {
238 const L = this.moves[index].length;
239 this.lastMove = this.moves[index][L - 1];
240 } else {
241 this.lastMove = this.moves[index];
242 }
3a2a7b5f 243 } else this.lastMove = null;
e71161fb 244 },
63ca2b89 245 analyzePosition: function() {
7ba4a5bc 246 let newUrl =
6808d7a1
BA
247 "/analyse/" +
248 this.game.vname +
249 "/?fen=" +
250 this.vr.getFen().replace(/ /g, "_");
7ba4a5bc
BA
251 if (this.game.mycolor)
252 newUrl += "&side=" + this.game.mycolor;
910d631b 253 // Open in same tab in live games (against cheating)
6808d7a1 254 if (this.game.type == "live") this.$router.push(newUrl);
910d631b 255 else window.open("#" + newUrl);
603b8a8b 256 },
a6088c90
BA
257 download: function() {
258 const content = this.getPgn();
259 // Prepare and trigger download link
260 let downloadAnchor = document.getElementById("download");
261 downloadAnchor.setAttribute("download", "game.pgn");
6808d7a1
BA
262 downloadAnchor.href =
263 "data:text/plain;charset=utf-8," + encodeURIComponent(content);
a6088c90
BA
264 downloadAnchor.click();
265 },
266 getPgn: function() {
267 let pgn = "";
268 pgn += '[Site "vchess.club"]\n';
834c202a 269 pgn += '[Variant "' + this.game.vname + '"]\n';
a6088c90 270 pgn += '[Date "' + getDate(new Date()) + '"]\n';
d4036efe
BA
271 pgn += '[White "' + this.game.players[0].name + '"]\n';
272 pgn += '[Black "' + this.game.players[1].name + '"]\n';
834c202a 273 pgn += '[Fen "' + this.game.fenStart + '"]\n';
430a2038 274 pgn += '[Result "' + this.game.score + '"]\n\n';
e71161fb
BA
275 for (let i = 0; i < this.moves.length; i += 2) {
276 pgn += (i/2+1) + "." + getFullNotation(this.moves[i]) + " ";
277 if (i+1 < this.moves.length)
278 pgn += getFullNotation(this.moves[i+1]) + " ";
a6088c90
BA
279 }
280 return pgn + "\n";
281 },
b988c726
BA
282 showEndgameMsg: function(message) {
283 this.endgameMessage = message;
aae89b49 284 document.getElementById("modalEog").checked = true;
a6088c90 285 },
54ec15eb
BA
286 runAutoplay: function() {
287 const infinitePlay = () => {
288 if (this.cursor == this.moves.length - 1) {
289 clearInterval(this.autoplayLoop);
290 this.autoplayLoop = null;
291 this.autoplay = false;
292 return;
293 }
294 if (this.inPlay || this.inMultimove)
295 // Wait next tick
296 return;
297 this.play();
298 };
299 if (this.autoplay) {
300 this.autoplay = false;
301 clearInterval(this.autoplayLoop);
302 this.autoplayLoop = null;
303 } else {
304 this.autoplay = true;
305 infinitePlay();
306 this.autoplayLoop = setInterval(infinitePlay, 1500);
307 }
308 },
e71161fb 309 // Animate an elementary move
63ca2b89 310 animateMove: function(move, callback) {
a6088c90 311 let startSquare = document.getElementById(getSquareId(move.start));
f9c36b2d 312 if (!startSquare) return; //shouldn't happen but...
a6088c90
BA
313 let endSquare = document.getElementById(getSquareId(move.end));
314 let rectStart = startSquare.getBoundingClientRect();
315 let rectEnd = endSquare.getBoundingClientRect();
6808d7a1
BA
316 let translation = {
317 x: rectEnd.x - rectStart.x,
318 y: rectEnd.y - rectStart.y
319 };
320 let movingPiece = document.querySelector(
321 "#" + getSquareId(move.start) + " > img.piece"
322 );
efdfb4c7
BA
323 // For some unknown reasons Opera get "movingPiece == null" error
324 // TOOO: is it calling 'animate()' twice ? One extra time ?
325 if (!movingPiece) return;
a6088c90
BA
326 // HACK for animation (with positive translate, image slides "under background")
327 // Possible improvement: just alter squares on the piece's way...
328 const squares = document.getElementsByClassName("board");
6808d7a1 329 for (let i = 0; i < squares.length; i++) {
a6088c90 330 let square = squares.item(i);
6808d7a1 331 if (square.id != getSquareId(move.start)) square.style.zIndex = "-1";
a6088c90 332 }
6808d7a1
BA
333 movingPiece.style.transform =
334 "translate(" + translation.x + "px," + translation.y + "px)";
910d631b 335 movingPiece.style.transitionDuration = "0.25s";
a6088c90 336 movingPiece.style.zIndex = "3000";
6808d7a1
BA
337 setTimeout(() => {
338 for (let i = 0; i < squares.length; i++)
a6088c90
BA
339 squares.item(i).style.zIndex = "auto";
340 movingPiece.style = {}; //required e.g. for 0-0 with KR swap
63ca2b89 341 callback();
a6088c90
BA
342 }, 250);
343 },
8055eabd
BA
344 // For Analyse mode:
345 emitFenIfAnalyze: function() {
346 if (this.game.mode == "analyze") {
347 this.$emit(
348 "fenchange",
f1c9d707 349 !!this.lastMove ? this.lastMove.fen : this.game.fenStart
8055eabd
BA
350 );
351 }
352 },
e71161fb 353 // "light": if gotoMove() or gotoEnd()
57eb158f 354 play: function(move, received, light, noemit) {
a6836242
BA
355 // Freeze while choices are shown:
356 if (this.$refs["board"].choices.length > 0) return;
57eb158f
BA
357 if (!!noemit) {
358 if (this.inPlay) {
359 // Received moves in observed games can arrive too fast:
360 this.stackToPlay.unshift(move);
361 return;
362 }
363 this.inPlay = true;
364 }
9d54ab89 365 const navigate = !move;
e71161fb 366 const playSubmove = (smove) => {
fbd68f75 367 smove.notation = this.vr.getNotation(smove);
e71161fb 368 this.vr.play(smove);
f14572c4 369 this.lastMove = smove;
fbd68f75 370 if (!this.inMultimove) {
54ec15eb
BA
371 // Condition is "!navigate" but we mean "!this.autoplay"
372 if (!navigate) {
373 if (this.cursor < this.moves.length - 1)
374 this.moves = this.moves.slice(0, this.cursor + 1);
375 this.moves.push(smove);
376 }
fbd68f75
BA
377 this.inMultimove = true; //potentially
378 this.cursor++;
54ec15eb 379 } else if (!navigate) {
fbd68f75
BA
380 // Already in the middle of a multi-move
381 const L = this.moves.length;
382 if (!Array.isArray(this.moves[L-1]))
383 this.$set(this.moves, L-1, [this.moves[L-1], smove]);
384 else
385 this.$set(this.moves, L-1, this.moves.concat([smove]));
e71161fb
BA
386 }
387 };
388 const playMove = () => {
54ec15eb 389 const animate = (
57d9b2c4 390 ["all", "highlight"].includes(V.ShowMoves) &&
54ec15eb
BA
391 (this.autoplay || !!received)
392 );
e71161fb
BA
393 if (!Array.isArray(move)) move = [move];
394 let moveIdx = 0;
395 let self = this;
396 const initurn = this.vr.turn;
397 (function executeMove() {
398 const smove = move[moveIdx++];
399 if (animate) {
400 self.animateMove(smove, () => {
401 playSubmove(smove);
402 if (moveIdx < move.length)
403 setTimeout(executeMove, 500);
404 else afterMove(smove, initurn);
405 });
406 } else {
407 playSubmove(smove);
408 if (moveIdx < move.length) executeMove();
409 else afterMove(smove, initurn);
410 }
411 })();
412 };
fbd68f75
BA
413 const computeScore = () => {
414 const score = this.vr.getCurrentScore();
f54f4c26
BA
415 if (!navigate) {
416 if (["1-0","0-1"].includes(score))
417 this.lastMove.notation += "#";
418 else if (this.vr.getCheckSquares(this.vr.turn).length > 0)
419 this.lastMove.notation += "+";
420 }
fbd68f75
BA
421 if (score != "*" && this.game.mode == "analyze") {
422 const message = getScoreMessage(score);
423 // Just show score on screen (allow undo)
424 this.showEndgameMsg(score + " . " + this.st.tr[message]);
425 }
426 return score;
427 };
e71161fb 428 const afterMove = (smove, initurn) => {
e71161fb
BA
429 if (this.vr.turn != initurn) {
430 // Turn has changed: move is complete
3a2a7b5f 431 if (!smove.fen)
cc00b83c
BA
432 // NOTE: only FEN of last sub-move is required (thus setting it here)
433 smove.fen = this.vr.getFen();
b0a0468a
BA
434 // Is opponent in check?
435 this.incheck = this.vr.getCheckSquares(this.vr.turn);
3a2a7b5f 436 this.emitFenIfAnalyze();
e71161fb 437 this.inMultimove = false;
f54f4c26 438 this.score = computeScore();
54ec15eb 439 if (this.game.mode != "analyze" && !navigate) {
f54f4c26 440 if (!noemit) {
5aa14a21 441 // Post-processing (e.g. computer play).
f54f4c26 442 const L = this.moves.length;
5aa14a21
BA
443 // NOTE: always emit the score, even in unfinished,
444 // to tell Game::processMove() that it's not a received move.
f54f4c26
BA
445 this.$emit("newmove", this.moves[L-1], { score: this.score });
446 } else {
57eb158f
BA
447 this.inPlay = false;
448 if (this.stackToPlay.length > 0)
449 // Move(s) arrived in-between
450 this.play(this.stackToPlay.pop(), received, light, noemit);
451 }
e71161fb
BA
452 }
453 }
454 };
455 // NOTE: navigate and received are mutually exclusive
456 if (navigate) {
457 // The move to navigate to is necessarily full:
458 if (this.cursor == this.moves.length - 1) return; //no more moves
459 move = this.moves[this.cursor + 1];
54ec15eb
BA
460 if (!this.autoplay) {
461 // Just play the move:
462 if (!Array.isArray(move)) move = [move];
463 for (let i=0; i < move.length; i++) this.vr.play(move[i]);
464 if (!light) {
465 this.lastMove = move[move.length-1];
466 this.incheck = this.vr.getCheckSquares(this.vr.turn);
467 this.score = computeScore();
468 this.emitFenIfAnalyze();
469 }
470 this.cursor++;
471 return;
8055eabd 472 }
e71161fb 473 }
63ca2b89
BA
474 // Forbid playing outside analyze mode, except if move is received.
475 // Sufficient condition because Board already knows which turn it is.
6808d7a1 476 if (
6808d7a1 477 this.game.mode != "analyze" &&
dcb3637c 478 !navigate &&
e71161fb 479 !received &&
6808d7a1
BA
480 (this.game.score != "*" || this.cursor < this.moves.length - 1)
481 ) {
a6088c90
BA
482 return;
483 }
e71161fb
BA
484 // To play a received move, cursor must be at the end of the game:
485 if (received && this.cursor < this.moves.length - 1)
486 this.gotoEnd();
487 playMove();
488 },
489 cancelCurrentMultimove: function() {
e71161fb
BA
490 const L = this.moves.length;
491 let move = this.moves[L-1];
492 if (!Array.isArray(move)) move = [move];
493 for (let i=move.length -1; i >= 0; i--) this.vr.undo(move[i]);
494 this.moves.pop();
495 this.cursor--;
496 this.inMultimove = false;
497 },
498 cancelLastMove: function() {
499 // The last played move was canceled (corr game)
500 this.undo();
501 this.moves.pop();
502 },
503 // "light": if gotoMove() or gotoBegin()
504 undo: function(move, light) {
a6836242
BA
505 // Freeze while choices are shown:
506 if (this.$refs["board"].choices.length > 0) return;
e71161fb
BA
507 if (this.inMultimove) {
508 this.cancelCurrentMultimove();
63ca2b89 509 this.incheck = this.vr.getCheckSquares(this.vr.turn);
e71161fb
BA
510 } else {
511 if (!move) {
3a2a7b5f
BA
512 const minCursor =
513 this.moves.length > 0 && this.moves[0].notation == "..."
514 ? 1
515 : 0;
516 if (this.cursor < minCursor) return; //no more moves
e71161fb
BA
517 move = this.moves[this.cursor];
518 }
e71161fb
BA
519 undoMove(move, this.vr);
520 if (light) this.cursor--;
521 else {
522 this.positionCursorTo(this.cursor - 1);
e71161fb 523 this.incheck = this.vr.getCheckSquares(this.vr.turn);
8055eabd 524 this.emitFenIfAnalyze();
63ca2b89 525 }
a6088c90 526 }
a6088c90
BA
527 },
528 gotoMove: function(index) {
a6836242 529 if (this.$refs["board"].choices.length > 0) return;
e71161fb
BA
530 if (this.inMultimove) this.cancelCurrentMultimove();
531 if (index == this.cursor) return;
532 if (index < this.cursor) {
533 while (this.cursor > index)
534 this.undo(null, null, "light");
535 }
536 else {
537 // index > this.cursor)
538 while (this.cursor < index)
539 this.play(null, null, "light");
540 }
541 // NOTE: next line also re-assign cursor, but it's very light
542 this.positionCursorTo(index);
8b405c81 543 this.incheck = this.vr.getCheckSquares(this.vr.turn);
8055eabd 544 this.emitFenIfAnalyze();
a6088c90
BA
545 },
546 gotoBegin: function() {
a6836242 547 if (this.$refs["board"].choices.length > 0) return;
e71161fb 548 if (this.inMultimove) this.cancelCurrentMultimove();
3a2a7b5f
BA
549 const minCursor =
550 this.moves.length > 0 && this.moves[0].notation == "..."
551 ? 1
552 : 0;
553 while (this.cursor >= minCursor) this.undo(null, null, "light");
554 this.lastMove = (minCursor == 1 ? this.moves[0] : null);
555 this.incheck = this.vr.getCheckSquares(this.vr.turn);
8055eabd 556 this.emitFenIfAnalyze();
a6088c90
BA
557 },
558 gotoEnd: function() {
a6836242 559 if (this.$refs["board"].choices.length > 0) return;
6808d7a1
BA
560 if (this.cursor == this.moves.length - 1) return;
561 this.gotoMove(this.moves.length - 1);
8055eabd 562 this.emitFenIfAnalyze();
a6088c90
BA
563 },
564 flip: function() {
a6836242 565 if (this.$refs["board"].choices.length > 0) return;
0e16cb26 566 this.orientation = V.GetOppCol(this.orientation);
6808d7a1
BA
567 }
568 }
a6088c90
BA
569};
570</script>
72ccbd67 571
41c80bb6 572<style lang="sass" scoped>
9a3049f3
BA
573[type="checkbox"]#modalEog+div .card
574 min-height: 45px
910d631b 575
cf94b843
BA
576#baseGame
577 width: 100%
4f518610
BA
578 &:focus
579 outline: none
cf94b843
BA
580
581#gameContainer
72ccbd67
BA
582 margin-left: auto
583 margin-right: auto
cf94b843 584
ed06d9e9
BA
585#downloadDiv
586 display: inline-block
587
72ccbd67 588#controls
28b32b4f 589 user-select: none
72ccbd67 590 button
b1e46b33 591 border: none
72ccbd67 592 margin: 0
feaf1bf7
BA
593 padding-top: 5px
594 padding-bottom: 5px
595
54ec15eb
BA
596.in-autoplay
597 background-color: #FACF8C
598
feaf1bf7 599img.inline
54ec15eb 600 height: 22px
feaf1bf7
BA
601 padding-top: 5px
602 @media screen and (max-width: 767px)
603 height: 18px
910d631b 604
0e16cb26
BA
605#turnIndicator
606 text-align: center
29bc61be 607 font-weight: bold
910d631b 608
72ccbd67 609#boardContainer
cf94b843 610 float: left
41c80bb6
BA
611// TODO: later, maybe, allow movesList of variable width
612// or e.g. between 250 and 350px (but more complicated)
910d631b 613
cf94b843
BA
614#movesList
615 width: 280px
616 float: left
910d631b 617
96e9585a
BA
618@media screen and (max-width: 767px)
619 #movesList
620 width: 100%
621 float: none
622 clear: both
72ccbd67 623</style>