Fixes
[vchess.git] / client / src / views / Game.vue
1 <template lang="pug">
2 main
3 input#modalChat.modal(type="checkbox" @click="resetChatColor")
4 div#chatWrap(role="dialog" data-checkbox="modalChat" aria-labelledby="inputChat")
5 #chat.card
6 label.modal-close(for="modalChat")
7 #participants
8 span {{ Object.keys(people).length + " " + st.tr["participant(s):"] }}
9 span(v-for="p in Object.values(people)" v-if="!!p.name")
10 | {{ p.name }}
11 span.anonymous(v-if="Object.values(people).some(p => !p.name)")
12 | + @nonymous
13 Chat(:players="game.players" :pastChats="game.chats"
14 :newChat="newChat" @mychat="processChat")
15 .row
16 #aboveBoard.col-sm-12.col-md-9.col-md-offset-3.col-lg-10.col-lg-offset-2
17 span.variant-info {{ game.vname }}
18 button#chatBtn(onClick="doClick('modalChat')") Chat
19 #actions(v-if="game.score=='*'")
20 button(@click="clickDraw" :class="{['draw-' + drawOffer]: true}")
21 | {{ st.tr["Draw"] }}
22 button(v-if="!!game.mycolor" @click="abortGame") {{ st.tr["Abort"] }}
23 button(v-if="!!game.mycolor" @click="resign") {{ st.tr["Resign"] }}
24 #playersInfo
25 p
26 span.name(:class="{connected: isConnected(0)}")
27 | {{ game.players[0].name || "@nonymous" }}
28 span.time(v-if="game.score=='*'") {{ virtualClocks[0] }}
29 span.split-names -
30 span.name(:class="{connected: isConnected(1)}")
31 | {{ game.players[1].name || "@nonymous" }}
32 span.time(v-if="game.score=='*'") {{ virtualClocks[1] }}
33 BaseGame(:game="game" :vr="vr" ref="basegame"
34 @newmove="processMove" @gameover="gameOver")
35 </template>
36
37 <script>
38 import BaseGame from "@/components/BaseGame.vue";
39 import Chat from "@/components/Chat.vue";
40 import { store } from "@/store";
41 import { GameStorage } from "@/utils/gameStorage";
42 import { ppt } from "@/utils/datetime";
43 import { extractTime } from "@/utils/timeControl";
44 import { ArrayFun } from "@/utils/array";
45 import { processModalClick } from "@/utils/modalClick";
46 import { getScoreMessage } from "@/utils/scoring";
47
48 export default {
49 name: 'my-game',
50 components: {
51 BaseGame,
52 Chat,
53 },
54 // gameRef: to find the game in (potentially remote) storage
55 data: function() {
56 return {
57 st: store.state,
58 gameRef: { //given in URL (rid = remote ID)
59 id: "",
60 rid: ""
61 },
62 game: { //passed to BaseGame
63 players:[{name:""},{name:""}],
64 rendered: false,
65 },
66 virtualClocks: [0, 0], //initialized with true game.clocks
67 vr: null, //"variant rules" object initialized from FEN
68 drawOffer: "",
69 people: {}, //players + observers
70 lastate: undefined, //used if opponent send lastate before game is ready
71 repeat: {}, //detect position repetition
72 newChat: "",
73 };
74 },
75 watch: {
76 "$route": function(to, from) {
77 this.gameRef.id = to.params["id"];
78 this.gameRef.rid = to.query["rid"];
79 this.loadGame();
80 },
81 "game.clocks": function(newState) {
82 if (this.game.moves.length < 2 || this.game.score != "*")
83 {
84 // 1st move not completed yet, or game over: freeze time
85 this.virtualClocks = newState.map(s => ppt(s));
86 return;
87 }
88 const currentTurn = this.vr.turn;
89 const colorIdx = ["w","b"].indexOf(currentTurn);
90 let countdown = newState[colorIdx] -
91 (Date.now() - this.game.initime[colorIdx])/1000;
92 this.virtualClocks = [0,1].map(i => {
93 const removeTime = i == colorIdx
94 ? (Date.now() - this.game.initime[colorIdx])/1000
95 : 0;
96 return ppt(newState[i] - removeTime);
97 });
98 let clockUpdate = setInterval(() => {
99 if (countdown < 0 || this.vr.turn != currentTurn || this.game.score != "*")
100 {
101 clearInterval(clockUpdate);
102 if (countdown < 0)
103 this.gameOver(this.vr.turn=="w" ? "0-1" : "1-0", this.st.tr["Time"]);
104 }
105 else
106 this.$set(this.virtualClocks, colorIdx, ppt(Math.max(0, --countdown)));
107 }, 1000);
108 },
109 },
110 // NOTE: some redundant code with Hall.vue (related to people array)
111 created: function() {
112 // Always add myself to players' list
113 const my = this.st.user;
114 this.$set(this.people, my.sid, {id:my.id, name:my.name});
115 this.gameRef.id = this.$route.params["id"];
116 this.gameRef.rid = this.$route.query["rid"]; //may be undefined
117 // Define socket .onmessage() and .onclose() events:
118 this.st.conn.onmessage = this.socketMessageListener;
119 const socketCloseListener = () => {
120 store.socketCloseListener(); //reinitialize connexion (in store.js)
121 this.st.conn.addEventListener('message', this.socketMessageListener);
122 this.st.conn.addEventListener('close', socketCloseListener);
123 };
124 this.st.conn.onclose = socketCloseListener;
125 // Socket init required before loading remote game:
126 const socketInit = (callback) => {
127 if (!!this.st.conn && this.st.conn.readyState == 1) //1 == OPEN state
128 callback();
129 else //socket not ready yet (initial loading)
130 this.st.conn.onopen = callback;
131 };
132 if (!this.gameRef.rid) //game stored locally or on server
133 this.loadGame(null, () => socketInit(this.roomInit));
134 else //game stored remotely: need socket to retrieve it
135 {
136 // NOTE: the callback "roomInit" will be lost, so we don't provide it.
137 // --> It will be given when receiving "fullgame" socket event.
138 // A more general approach would be to store it somewhere.
139 socketInit(this.loadGame);
140 }
141 },
142 mounted: function() {
143 document.getElementById("chatWrap").addEventListener(
144 "click", processModalClick);
145 },
146 methods: {
147 // O.1] Ask server for room composition:
148 roomInit: function() {
149 // Notify the room only now that I connected, because
150 // messages might be lost otherwise (if game loading is slow)
151 this.st.conn.send(JSON.stringify({code:"connect"}));
152 this.st.conn.send(JSON.stringify({code:"pollclients"}));
153 },
154 isConnected: function(index) {
155 const player = this.game.players[index];
156 // Is it me ?
157 if (this.st.user.sid == player.sid || this.st.user.id == player.uid)
158 return true;
159 // Try to find a match in people:
160 return Object.keys(this.people).some(sid => sid == player.sid) ||
161 Object.values(this.people).some(p => p.id == player.uid);
162 },
163 socketMessageListener: function(msg) {
164 const data = JSON.parse(msg.data);
165 switch (data.code)
166 {
167 case "duplicate":
168 alert(this.st.tr["Warning: multi-tabs not supported"]);
169 break;
170 // 0.2] Receive clients list (just socket IDs)
171 case "pollclients":
172 {
173 data.sockIds.forEach(sid => {
174 if (!!this.people[sid])
175 return;
176 this.$set(this.people, sid, {id:0, name:""});
177 // Ask only identity
178 this.st.conn.send(JSON.stringify({code:"askidentity", target:sid}));
179 });
180 break;
181 }
182 case "askidentity":
183 {
184 // Request for identification: reply if I'm not anonymous
185 if (this.st.user.id > 0)
186 {
187 this.st.conn.send(JSON.stringify({code:"identity",
188 user: {
189 // NOTE: decompose to avoid revealing email
190 name: this.st.user.name,
191 sid: this.st.user.sid,
192 id: this.st.user.id,
193 },
194 target:data.from}));
195 }
196 break;
197 }
198 case "identity":
199 {
200 this.$set(this.people, data.user.sid,
201 {id: data.user.id, name: data.user.name});
202 // Ask potentially missed last state, if opponent and I play
203 if (!!this.game.mycolor
204 && this.game.type == "live" && this.game.score == "*"
205 && this.game.players.some(p => p.sid == data.user.sid))
206 {
207 this.st.conn.send(JSON.stringify({code:"asklastate", target:data.user.sid}));
208 }
209 break;
210 }
211 case "asklastate":
212 {
213 // Sending last state if I played a move or score != "*"
214 if ((this.game.moves.length > 0 && this.vr.turn != this.game.mycolor)
215 || this.game.score != "*" || this.drawOffer == "sent")
216 {
217 // Send our "last state" informations to opponent
218 const L = this.game.moves.length;
219 const myIdx = ["w","b"].indexOf(this.game.mycolor);
220 this.st.conn.send(JSON.stringify({
221 code: "lastate",
222 target: data.from,
223 state:
224 {
225 // NOTE: lastMove (when defined) includes addTime
226 lastMove: (L>0 ? this.game.moves[L-1] : undefined),
227 // Since we played a move (or abort or resign),
228 // only drawOffer=="sent" is possible
229 drawSent: this.drawOffer == "sent",
230 score: this.game.score,
231 movesCount: L,
232 initime: this.game.initime[1-myIdx], //relevant only if I played
233 }
234 }));
235 }
236 break;
237 }
238 case "askgame":
239 // Send current (live) game if I play in (not an observer),
240 // and not asked by opponent (!)
241 if (this.game.type == "live"
242 && this.game.players.some(p => p.sid == this.st.user.sid)
243 && this.game.players.every(p => p.sid != data.from))
244 {
245 const myGame =
246 {
247 // Minimal game informations:
248 id: this.game.id,
249 players: this.game.players,
250 vid: this.game.vid,
251 timeControl: this.game.timeControl,
252 score: this.game.score,
253 };
254 this.st.conn.send(JSON.stringify({code:"game",
255 game:myGame, target:data.from}));
256 }
257 break;
258 case "newmove":
259 if (!!data.move.cancelDrawOffer) //opponent refuses draw
260 {
261 this.drawOffer = "";
262 // NOTE for corr games: drawOffer reset by player in turn
263 if (this.game.type == "live" && !!this.game.mycolor)
264 GameStorage.update(this.gameRef.id, {drawOffer: ""});
265 }
266 this.$set(this.game, "moveToPlay", data.move);
267 break;
268 case "newchat":
269 this.newChat = data.chat;
270 if (!document.getElementById("modalChat").checked)
271 document.getElementById("chatBtn").style.backgroundColor = "#c5fefe";
272 break;
273 case "lastate": //got opponent infos about last move
274 {
275 this.lastate = data.state;
276 if (this.game.rendered) //game is rendered (Board component)
277 this.processLastate();
278 //else: will be processed when game is ready
279 break;
280 }
281 case "resign":
282 this.gameOver(data.side=="b" ? "1-0" : "0-1", "Resign");
283 break;
284 case "abort":
285 this.gameOver("?", "Abort");
286 break;
287 case "draw":
288 this.gameOver("1/2", data.message);
289 break;
290 case "drawoffer":
291 // NOTE: observers don't know who offered draw
292 this.drawOffer = "received";
293 break;
294 case "askfullgame":
295 this.st.conn.send(JSON.stringify({code:"fullgame",
296 game:this.game, target:data.from}));
297 break;
298 case "fullgame":
299 // Callback "roomInit" to poll clients only after game is loaded
300 this.loadGame(data.game, this.roomInit);
301 break;
302 case "connect":
303 {
304 this.$set(this.people, data.from, {name:"", id:0});
305 this.st.conn.send(JSON.stringify({code:"askidentity", target:data.from}));
306 break;
307 }
308 case "disconnect":
309 this.$delete(this.people, data.from);
310 break;
311 }
312 },
313 // lastate was received, but maybe game wasn't ready yet:
314 processLastate: function() {
315 const data = this.lastate;
316 this.lastate = undefined; //security...
317 const L = this.game.moves.length;
318 if (data.movesCount > L)
319 {
320 // Just got last move from him
321 this.$set(this.game, "moveToPlay", Object.assign({}, data.lastMove, {initime: data.initime}));
322 }
323 if (data.drawSent)
324 this.drawOffer = "received";
325 if (data.score != "*")
326 {
327 this.drawOffer = "";
328 if (this.game.score == "*")
329 this.gameOver(data.score);
330 }
331 },
332 clickDraw: function() {
333 if (!this.game.mycolor)
334 return; //I'm just spectator
335 if (["received","threerep"].includes(this.drawOffer))
336 {
337 if (!confirm(this.st.tr["Accept draw?"]))
338 return;
339 const message = (this.drawOffer == "received"
340 ? "Mutual agreement"
341 : "Three repetitions");
342 Object.keys(this.people).forEach(sid => {
343 if (sid != this.st.user.sid)
344 {
345 this.st.conn.send(JSON.stringify({code:"draw",
346 message:message, target:sid}));
347 }
348 });
349 this.gameOver("1/2", message);
350 }
351 else if (this.drawOffer == "") //no effect if drawOffer == "sent"
352 {
353 if (this.game.mycolor != this.vr.turn)
354 return alert(this.st.tr["Draw offer only in your turn"]);
355 if (!confirm(this.st.tr["Offer draw?"]))
356 return;
357 this.drawOffer = "sent";
358 Object.keys(this.people).forEach(sid => {
359 if (sid != this.st.user.sid)
360 this.st.conn.send(JSON.stringify({code:"drawoffer", target:sid}));
361 });
362 GameStorage.update(this.gameRef.id, {drawOffer: this.game.mycolor});
363 }
364 },
365 abortGame: function() {
366 if (!this.game.mycolor || !confirm(this.st.tr["Terminate game?"]))
367 return;
368 this.gameOver("?", "Abort");
369 Object.keys(this.people).forEach(sid => {
370 if (sid != this.st.user.sid)
371 {
372 this.st.conn.send(JSON.stringify({
373 code: "abort",
374 target: sid,
375 }));
376 }
377 });
378 },
379 resign: function(e) {
380 if (!this.game.mycolor || !confirm(this.st.tr["Resign the game?"]))
381 return;
382 Object.keys(this.people).forEach(sid => {
383 if (sid != this.st.user.sid)
384 {
385 this.st.conn.send(JSON.stringify({code:"resign",
386 side:this.game.mycolor, target:sid}));
387 }
388 });
389 this.gameOver(this.game.mycolor=="w" ? "0-1" : "1-0", "Resign");
390 },
391 // 3 cases for loading a game:
392 // - from indexedDB (running or completed live game I play)
393 // - from server (one correspondance game I play[ed] or not)
394 // - from remote peer (one live game I don't play, finished or not)
395 loadGame: function(game, callback) {
396 const afterRetrieval = async (game) => {
397 const vModule = await import("@/variants/" + game.vname + ".js");
398 window.V = vModule.VariantRules;
399 this.vr = new V(game.fen);
400 const gtype = (game.timeControl.indexOf('d') >= 0 ? "corr" : "live");
401 const tc = extractTime(game.timeControl);
402 if (gtype == "corr")
403 {
404 if (game.players[0].color == "b")
405 {
406 // Adopt the same convention for live and corr games: [0] = white
407 [ game.players[0], game.players[1] ] =
408 [ game.players[1], game.players[0] ];
409 }
410 // corr game: needs to compute the clocks + initime
411 // NOTE: clocks in seconds, initime in milliseconds
412 game.clocks = [tc.mainTime, tc.mainTime];
413 game.moves.sort((m1,m2) => m1.idx - m2.idx); //in case of
414 if (game.score == "*") //otherwise no need to bother with time
415 {
416 game.initime = [0, 0];
417 const L = game.moves.length;
418 if (L >= 3)
419 {
420 let addTime = [0, 0];
421 for (let i=2; i<L; i++)
422 {
423 addTime[i%2] += tc.increment -
424 (game.moves[i].played - game.moves[i-1].played) / 1000;
425 }
426 for (let i=0; i<=1; i++)
427 game.clocks[i] += addTime[i];
428 }
429 if (L >= 1)
430 game.initime[L%2] = game.moves[L-1].played;
431 }
432 // Now that we used idx and played, re-format moves as for live games
433 game.moves = game.moves.map( (m) => {
434 const s = m.squares;
435 return {
436 appear: s.appear,
437 vanish: s.vanish,
438 start: s.start,
439 end: s.end,
440 };
441 });
442 // Also sort chat messages (if any)
443 game.chats.sort( (c1,c2) => { return c2.added - c1.added; });
444 }
445 const myIdx = game.players.findIndex(p => {
446 return p.sid == this.st.user.sid || p.uid == this.st.user.id;
447 });
448 if (gtype == "live" && game.clocks[0] < 0) //game unstarted
449 {
450 game.clocks = [tc.mainTime, tc.mainTime];
451 if (game.score == "*")
452 {
453 game.initime[0] = Date.now();
454 if (myIdx >= 0)
455 {
456 // I play in this live game; corr games don't have clocks+initime
457 GameStorage.update(game.id,
458 {
459 clocks: game.clocks,
460 initime: game.initime,
461 });
462 }
463 }
464 }
465 if (!!game.drawOffer)
466 {
467 if (game.drawOffer == "t") //three repetitions
468 this.drawOffer = "threerep";
469 else
470 {
471 if (myIdx < 0)
472 this.drawOffer = "received"; //by any of the players
473 else
474 {
475 // I play in this game:
476 if ((game.drawOffer == "w" && myIdx==0) || (game.drawOffer=="b" && myIdx==1))
477 this.drawOffer = "sent";
478 else //all other cases
479 this.drawOffer = "received";
480 }
481 }
482 }
483 if (!!game.scoreMsg)
484 game.scoreMsg = this.st.tr[game.scoreMsg]; //stored in english
485 this.game = Object.assign({},
486 game,
487 // NOTE: assign mycolor here, since BaseGame could also be VS computer
488 {
489 type: gtype,
490 increment: tc.increment,
491 mycolor: [undefined,"w","b"][myIdx+1],
492 // opponent sid not strictly required (or available), but easier
493 // at least oppsid or oppid is available anyway:
494 oppsid: (myIdx < 0 ? undefined : game.players[1-myIdx].sid),
495 oppid: (myIdx < 0 ? undefined : game.players[1-myIdx].uid),
496 }
497 );
498 this.$nextTick(() => {
499 this.game.rendered = true;
500 // Did lastate arrive before game was rendered?
501 if (!!this.lastate)
502 this.processLastate();
503 });
504 this.repeat = {}; //reset: scan past moves' FEN:
505 let repIdx = 0;
506 // NOTE: vr_tmp to obtain FEN strings is redundant with BaseGame
507 let vr_tmp = new V(game.fenStart);
508 game.moves.forEach(m => {
509 vr_tmp.play(m);
510 const fenObj = V.ParseFen( vr_tmp.getFen() );
511 repIdx = fenObj.position + "_" + fenObj.turn;
512 if (!!fenObj.flags)
513 repIdx += "_" + fenObj.flags;
514 this.repeat[repIdx] = (!!this.repeat[repIdx]
515 ? this.repeat[repIdx]+1
516 : 1);
517 });
518 if (this.repeat[repIdx] >= 3)
519 this.drawOffer = "threerep";
520 callback();
521 };
522 if (!!game)
523 return afterRetrieval(game);
524 if (!!this.gameRef.rid)
525 {
526 // Remote live game: forgetting about callback func... (TODO: design)
527 this.st.conn.send(JSON.stringify(
528 {code:"askfullgame", target:this.gameRef.rid}));
529 }
530 else
531 {
532 // Local or corr game
533 GameStorage.get(this.gameRef.id, afterRetrieval);
534 }
535 },
536 // Post-process a move (which was just played)
537 processMove: function(move) {
538 // Update storage (corr or live) if I play in the game
539 const colorIdx = ["w","b"].indexOf(move.color);
540 const nextIdx = ["w","b"].indexOf(this.vr.turn);
541 // https://stackoverflow.com/a/38750895
542 if (!!this.game.mycolor)
543 {
544 const allowed_fields = ["appear", "vanish", "start", "end"];
545 // NOTE: 'var' to see this variable outside this block
546 var filtered_move = Object.keys(move)
547 .filter(key => allowed_fields.includes(key))
548 .reduce((obj, key) => {
549 obj[key] = move[key];
550 return obj;
551 }, {});
552 }
553 // Send move ("newmove" event) to people in the room (if our turn)
554 let addTime = 0;
555 if (move.color == this.game.mycolor)
556 {
557 if (this.drawOffer == "received") //I refuse draw
558 this.drawOffer = "";
559 if (this.game.moves.length >= 2) //after first move
560 {
561 const elapsed = Date.now() - this.game.initime[colorIdx];
562 // elapsed time is measured in milliseconds
563 addTime = this.game.increment - elapsed/1000;
564 }
565 const sendMove = Object.assign({},
566 filtered_move,
567 {
568 addTime: addTime,
569 cancelDrawOffer: this.drawOffer=="",
570 });
571 Object.keys(this.people).forEach(sid => {
572 if (sid != this.st.user.sid)
573 {
574 this.st.conn.send(JSON.stringify({
575 code: "newmove",
576 target: sid,
577 move: sendMove,
578 }));
579 }
580 });
581 // (Add)Time indication: useful in case of lastate infos requested
582 move.addTime = addTime;
583 }
584 else
585 addTime = move.addTime; //supposed transmitted
586 // Update current game object:
587 this.game.moves.push(move);
588 this.game.fen = move.fen;
589 this.$set(this.game.clocks, colorIdx, this.game.clocks[colorIdx] + addTime);
590 // move.initime is set only when I receive a "lastate" move from opponent
591 this.game.initime[nextIdx] = move.initime || Date.now();
592 // If repetition detected, consider that a draw offer was received:
593 const fenObj = V.ParseFen(move.fen);
594 let repIdx = fenObj.position + "_" + fenObj.turn;
595 if (!!fenObj.flags)
596 repIdx += "_" + fenObj.flags;
597 this.repeat[repIdx] = (!!this.repeat[repIdx]
598 ? this.repeat[repIdx]+1
599 : 1);
600 if (this.repeat[repIdx] >= 3)
601 this.drawOffer = "threerep";
602 else if (this.drawOffer == "threerep")
603 this.drawOffer = "";
604 // Since corr games are stored at only one location, update should be
605 // done only by one player for each move:
606 if (!!this.game.mycolor &&
607 (this.game.type == "live" || move.color == this.game.mycolor))
608 {
609 let drawCode = "";
610 switch (this.drawOffer)
611 {
612 case "threerep":
613 drawCode = "t";
614 break;
615 case "sent":
616 drawCode = this.game.mycolor;
617 break;
618 case "received":
619 drawCode = this.vr.turn;
620 break;
621 }
622 if (this.game.type == "corr")
623 {
624 GameStorage.update(this.gameRef.id,
625 {
626 fen: move.fen,
627 move:
628 {
629 squares: filtered_move,
630 played: Date.now(),
631 idx: this.game.moves.length - 1,
632 },
633 drawOffer: drawCode || "n", //"n" for "None" to force reset (otherwise it's ignored)
634 });
635 }
636 else //live
637 {
638 GameStorage.update(this.gameRef.id,
639 {
640 fen: move.fen,
641 move: filtered_move,
642 clocks: this.game.clocks,
643 initime: this.game.initime,
644 drawOffer: drawCode,
645 });
646 }
647 }
648 },
649 resetChatColor: function() {
650 // TODO: this is called twice, once on opening an once on closing
651 document.getElementById("chatBtn").style.backgroundColor = "#e2e2e2";
652 },
653 processChat: function(chat) {
654 this.st.conn.send(JSON.stringify({code:"newchat", chat:chat}));
655 // NOTE: anonymous chats in corr games are not stored on server (TODO?)
656 if (this.game.type == "corr" && this.st.user.id > 0)
657 GameStorage.update(this.gameRef.id, {chat: chat});
658 },
659 gameOver: function(score, scoreMsg) {
660 this.game.score = score;
661 this.game.scoreMsg = this.st.tr[(!!scoreMsg
662 ? scoreMsg
663 : getScoreMessage(score))];
664 const myIdx = this.game.players.findIndex(p => {
665 return p.sid == this.st.user.sid || p.uid == this.st.user.id;
666 });
667 if (myIdx >= 0) //OK, I play in this game
668 {
669 GameStorage.update(this.gameRef.id,
670 {score: score, scoreMsg: scoreMsg});
671 }
672 },
673 },
674 };
675 </script>
676
677 <style lang="sass" scoped>
678 .connected
679 background-color: lightgreen
680
681 #participants
682 margin-left: 5px
683
684 .anonymous
685 color: grey
686 font-style: italic
687
688 @media screen and (min-width: 768px)
689 #actions
690 width: 300px
691 @media screen and (max-width: 767px)
692 .game
693 width: 100%
694
695 #actions
696 display: inline-block
697 margin-top: 10px
698 button
699 display: inline-block
700 margin: 0
701
702 @media screen and (max-width: 767px)
703 #aboveBoard
704 text-align: center
705 @media screen and (min-width: 768px)
706 #aboveBoard
707 margin-left: 30%
708
709 .variant-info
710 font-weight: bold
711 padding-right: 10px
712
713 .name
714 font-size: 1.5rem
715 padding: 1px
716
717 .time
718 font-size: 2rem
719 display: inline-block
720 margin-left: 10px
721
722 .split-names
723 display: inline-block
724 margin: 0 15px
725
726 #chat
727 padding-top: 20px
728 max-width: 600px
729 border: none;
730
731 #chatBtn
732 margin: 0 10px 0 0
733
734 .draw-sent, .draw-sent:hover
735 background-color: lightyellow
736
737 .draw-received, .draw-received:hover
738 background-color: lightgreen
739
740 .draw-threerep, .draw-threerep:hover
741 background-color: #e4d1fc
742 </style>