diff --git a/.gitignore b/.gitignore index cdcce24..5f34ddf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ JS_Basic_Challenges/cat + +\.DS_Store diff --git a/JS_Basic_Challenges/.DS_Store b/JS_Basic_Challenges/.DS_Store new file mode 100644 index 0000000..c1a02e8 Binary files /dev/null and b/JS_Basic_Challenges/.DS_Store differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/.DS_Store b/JS_Basic_Challenges/4-DOM-pig-game/.DS_Store new file mode 100644 index 0000000..7554a3c Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/.DS_Store differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/.DS_Store b/JS_Basic_Challenges/4-DOM-pig-game/final/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/final/.DS_Store differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/app.js b/JS_Basic_Challenges/4-DOM-pig-game/final/app.js new file mode 100755 index 0000000..14e6806 --- /dev/null +++ b/JS_Basic_Challenges/4-DOM-pig-game/final/app.js @@ -0,0 +1,122 @@ +/* +GAME RULES: + +- The game has 2 players, playing in rounds +- In each turn, a player rolls a dice as many times as he whishes. Each result get added to his ROUND score +- BUT, if the player rolls a 1, all his ROUND score gets lost. After that, it's the next player's turn +- The player can choose to 'Hold', which means that his ROUND score gets added to his GLBAL score. After that, it's the next player's turn +- The first player to reach 100 points on GLOBAL score wins the game + +*/ + +var scores, roundScore, activePlayer, gamePlaying; + +init(); + + +document.querySelector('.btn-roll').addEventListener('click', function() { + if(gamePlaying) { + // 1. Random number + var dice = Math.floor(Math.random() * 6) + 1; + + //2. Display the result + var diceDOM = document.querySelector('.dice'); + diceDOM.style.display = 'block'; + diceDOM.src = 'dice-' + dice + '.png'; + + + //3. Update the round score IF the rolled number was NOT a 1 + if (dice !== 1) { + //Add score + roundScore += dice; + document.querySelector('#current-' + activePlayer).textContent = roundScore; + } else { + //Next player + nextPlayer(); + } + } +}); + + +document.querySelector('.btn-hold').addEventListener('click', function() { + if (gamePlaying) { + // Add CURRENT score to GLOBAL score + scores[activePlayer] += roundScore; + + // Update the UI + document.querySelector('#score-' + activePlayer).textContent = scores[activePlayer]; + + // Check if player won the game + if (scores[activePlayer] >= 100) { + document.querySelector('#name-' + activePlayer).textContent = 'Winner!'; + document.querySelector('.dice').style.display = 'none'; + document.querySelector('.player-' + activePlayer + '-panel').classList.add('winner'); + document.querySelector('.player-' + activePlayer + '-panel').classList.remove('active'); + gamePlaying = false; + } else { + //Next player + nextPlayer(); + } + } +}); + + +function nextPlayer() { + //Next player + activePlayer === 0 ? activePlayer = 1 : activePlayer = 0; + roundScore = 0; + + document.getElementById('current-0').textContent = '0'; + document.getElementById('current-1').textContent = '0'; + + document.querySelector('.player-0-panel').classList.toggle('active'); + document.querySelector('.player-1-panel').classList.toggle('active'); + + //document.querySelector('.player-0-panel').classList.remove('active'); + //document.querySelector('.player-1-panel').classList.add('active'); + + document.querySelector('.dice').style.display = 'none'; +} + +document.querySelector('.btn-new').addEventListener('click', init); + +function init() { + scores = [0, 0]; + activePlayer = 0; + roundScore = 0; + gamePlaying = true; + + document.querySelector('.dice').style.display = 'none'; + + document.getElementById('score-0').textContent = '0'; + document.getElementById('score-1').textContent = '0'; + document.getElementById('current-0').textContent = '0'; + document.getElementById('current-1').textContent = '0'; + document.getElementById('name-0').textContent = 'Player 1'; + document.getElementById('name-1').textContent = 'Player 2'; + document.querySelector('.player-0-panel').classList.remove('winner'); + document.querySelector('.player-1-panel').classList.remove('winner'); + document.querySelector('.player-0-panel').classList.remove('active'); + document.querySelector('.player-1-panel').classList.remove('active'); + document.querySelector('.player-0-panel').classList.add('active'); +} + +//document.querySelector('#current-' + activePlayer).textContent = dice; +//document.querySelector('#current-' + activePlayer).innerHTML = '' + dice + ''; +//var x = document.querySelector('#score-0').textContent; + + + + + + + + +/* +YOUR 3 CHALLENGES +Change the game to follow these rules: + +1. A player looses his ENTIRE score when he rolls two 6 in a row. After that, it's the next player's turn. (Hint: Always save the previous dice roll in a separate variable) +2. Add an input field to the HTML where players can set the winning score, so that they can change the predefined score of 100. (Hint: you can read that value with the .value property in JavaScript. This is a good oportunity to use google to figure this out :) +3. Add another dice to the game, so that there are two dices now. The player looses his current score when one of them is a 1. (Hint: you will need CSS to position the second dice, so take a look at the CSS code for the first one.) +*/ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/back.jpg b/JS_Basic_Challenges/4-DOM-pig-game/final/back.jpg new file mode 100755 index 0000000..dcd9a7d Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/final/back.jpg differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/challenges.js b/JS_Basic_Challenges/4-DOM-pig-game/final/challenges.js new file mode 100644 index 0000000..2f4a85b --- /dev/null +++ b/JS_Basic_Challenges/4-DOM-pig-game/final/challenges.js @@ -0,0 +1,133 @@ +/* +YOUR 3 CHALLENGES +Change the game to follow these rules: + +1. A player looses his ENTIRE score when he rolls two 6 in a row. After that, it's the next player's turn. (Hint: Always save the previous dice roll in a separate variable) +2. Add an input field to the HTML where players can set the winning score, so that they can change the predefined score of 100. (Hint: you can read that value with the .value property in JavaScript. This is a good oportunity to use google to figure this out :) +3. Add another dice to the game, so that there are two dices now. The player looses his current score when one of them is a 1. (Hint: you will need CSS to position the second dice, so take a look at the CSS code for the first one.) +*/ + +var scores, roundScore, activePlayer, gamePlaying; + +init(); + +var lastDice; + +document.querySelector('.btn-roll').addEventListener('click', function() { + if(gamePlaying) { + // 1. Random number + var dice1 = Math.floor(Math.random() * 6) + 1; + var dice2 = Math.floor(Math.random() * 6) + 1; + + //2. Display the result + document.getElementById('dice-1').style.display = 'block'; + document.getElementById('dice-2').style.display = 'block'; + document.getElementById('dice-1').src = 'dice-' + dice1 + '.png'; + document.getElementById('dice-2').src = 'dice-' + dice2 + '.png'; + + //3. Update the round score IF the rolled number was NOT a 1 + if (dice1 !== 1 && dice2 !== 1) { + //Add score + roundScore += dice1 + dice2; + document.querySelector('#current-' + activePlayer).textContent = roundScore; + } else { + //Next player + nextPlayer(); + } + + /* + if (dice === 6 && lastDice === 6) { + //Player looses score + scores[activePlayer] = 0; + document.querySelector('#score-' + activePlayer).textContent = '0'; + nextPlayer(); + } else if (dice !== 1) { + //Add score + roundScore += dice; + document.querySelector('#current-' + activePlayer).textContent = roundScore; + } else { + //Next player + nextPlayer(); + } + lastDice = dice; + */ + } +}); + + +document.querySelector('.btn-hold').addEventListener('click', function() { + if (gamePlaying) { + // Add CURRENT score to GLOBAL score + scores[activePlayer] += roundScore; + + // Update the UI + document.querySelector('#score-' + activePlayer).textContent = scores[activePlayer]; + + var input = document.querySelector('.final-score').value; + var winningScore; + + // Undefined, 0, null or "" are COERCED to false + // Anything else is COERCED to true + if(input) { + winningScore = input; + } else { + winningScore = 100; + } + + // Check if player won the game + if (scores[activePlayer] >= winningScore) { + document.querySelector('#name-' + activePlayer).textContent = 'Winner!'; + document.getElementById('dice-1').style.display = 'none'; + document.getElementById('dice-2').style.display = 'none'; + document.querySelector('.player-' + activePlayer + '-panel').classList.add('winner'); + document.querySelector('.player-' + activePlayer + '-panel').classList.remove('active'); + gamePlaying = false; + } else { + //Next player + nextPlayer(); + } + } +}); + + +function nextPlayer() { + //Next player + activePlayer === 0 ? activePlayer = 1 : activePlayer = 0; + roundScore = 0; + + document.getElementById('current-0').textContent = '0'; + document.getElementById('current-1').textContent = '0'; + + document.querySelector('.player-0-panel').classList.toggle('active'); + document.querySelector('.player-1-panel').classList.toggle('active'); + + //document.querySelector('.player-0-panel').classList.remove('active'); + //document.querySelector('.player-1-panel').classList.add('active'); + + document.getElementById('dice-1').style.display = 'none'; + document.getElementById('dice-2').style.display = 'none'; +} + +document.querySelector('.btn-new').addEventListener('click', init); + +function init() { + scores = [0, 0]; + activePlayer = 0; + roundScore = 0; + gamePlaying = true; + + document.getElementById('dice-1').style.display = 'none'; + document.getElementById('dice-2').style.display = 'none'; + + document.getElementById('score-0').textContent = '0'; + document.getElementById('score-1').textContent = '0'; + document.getElementById('current-0').textContent = '0'; + document.getElementById('current-1').textContent = '0'; + document.getElementById('name-0').textContent = 'Player 1'; + document.getElementById('name-1').textContent = 'Player 2'; + document.querySelector('.player-0-panel').classList.remove('winner'); + document.querySelector('.player-1-panel').classList.remove('winner'); + document.querySelector('.player-0-panel').classList.remove('active'); + document.querySelector('.player-1-panel').classList.remove('active'); + document.querySelector('.player-0-panel').classList.add('active'); +} \ No newline at end of file diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/dice-1.png b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-1.png new file mode 100755 index 0000000..0d911ca Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-1.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/dice-2.png b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-2.png new file mode 100755 index 0000000..f3c32af Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-2.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/dice-3.png b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-3.png new file mode 100755 index 0000000..e3ef2b5 Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-3.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/dice-4.png b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-4.png new file mode 100755 index 0000000..0c785f7 Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-4.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/dice-5.png b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-5.png new file mode 100755 index 0000000..b4b41e3 Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-5.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/dice-6.png b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-6.png new file mode 100755 index 0000000..6f4d9b3 Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/final/dice-6.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/index.html b/JS_Basic_Challenges/4-DOM-pig-game/final/index.html new file mode 100755 index 0000000..38f75e8 --- /dev/null +++ b/JS_Basic_Challenges/4-DOM-pig-game/final/index.html @@ -0,0 +1,45 @@ + + + + + + + + + Pig Game + + + +
+
+
Player 1
+
43
+
+
Current
+
11
+
+
+ +
+
Player 2
+
72
+
+
Current
+
0
+
+
+ + + + + + + + Dice + Dice +
+ + + + + \ No newline at end of file diff --git a/JS_Basic_Challenges/4-DOM-pig-game/final/style.css b/JS_Basic_Challenges/4-DOM-pig-game/final/style.css new file mode 100755 index 0000000..2e67a21 --- /dev/null +++ b/JS_Basic_Challenges/4-DOM-pig-game/final/style.css @@ -0,0 +1,174 @@ +/********************************************** +*** GENERAL +**********************************************/ + +.final-score { + position: absolute; + left: 50%; + transform: translateX(-50%); + top: 520px; + color: #555; + font-size: 18px; + font-family: 'Lato'; + text-align: center; + padding: 10px; + width: 160px; + text-transform: uppercase; +} + +.final-score:focus { outline: none; } + +#dice-1 { top: 120px; } +#dice-2 { top: 250px; } + + +* { + margin: 0; + padding: 0; + box-sizing: border-box; + +} + +.clearfix::after { + content: ""; + display: table; + clear: both; +} + +body { + background-image: linear-gradient(rgba(62, 20, 20, 0.4), rgba(62, 20, 20, 0.4)), url(back.jpg); + background-size: cover; + background-position: center; + font-family: Lato; + font-weight: 300; + position: relative; + height: 100vh; + color: #555; +} + +.wrapper { + width: 1000px; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: #fff; + box-shadow: 0px 10px 50px rgba(0, 0, 0, 0.3); + overflow: hidden; +} + +.player-0-panel, +.player-1-panel { + width: 50%; + float: left; + height: 600px; + padding: 100px; +} + + + +/********************************************** +*** PLAYERS +**********************************************/ + +.player-name { + font-size: 40px; + text-align: center; + text-transform: uppercase; + letter-spacing: 2px; + font-weight: 100; + margin-top: 20px; + margin-bottom: 10px; + position: relative; +} + +.player-score { + text-align: center; + font-size: 80px; + font-weight: 100; + color: #EB4D4D; + margin-bottom: 130px; +} + +.active { background-color: #f7f7f7; } +.active .player-name { font-weight: 300; } + +.active .player-name::after { + content: "\2022"; + font-size: 47px; + position: absolute; + color: #EB4D4D; + top: -7px; + right: 10px; + +} + +.player-current-box { + background-color: #EB4D4D; + color: #fff; + width: 40%; + margin: 0 auto; + padding: 12px; + text-align: center; +} + +.player-current-label { + text-transform: uppercase; + margin-bottom: 10px; + font-size: 12px; + color: #222; +} + +.player-current-score { + font-size: 30px; +} + +button { + position: absolute; + width: 200px; + left: 50%; + transform: translateX(-50%); + color: #555; + background: none; + border: none; + font-family: Lato; + font-size: 20px; + text-transform: uppercase; + cursor: pointer; + font-weight: 300; + transition: background-color 0.3s, color 0.3s; +} + +button:hover { font-weight: 600; } +button:hover i { margin-right: 20px; } + +button:focus { + outline: none; +} + +i { + color: #EB4D4D; + display: inline-block; + margin-right: 15px; + font-size: 32px; + line-height: 1; + vertical-align: text-top; + margin-top: -4px; + transition: margin 0.3s; +} + +.btn-new { top: 45px;} +.btn-roll { top: 403px;} +.btn-hold { top: 467px;} + +.dice { + position: absolute; + left: 50%; + top: 178px; + transform: translateX(-50%); + height: 100px; + box-shadow: 0px 10px 60px rgba(0, 0, 0, 0.10); +} + +.winner { background-color: #f7f7f7; } +.winner .player-name { font-weight: 300; color: #EB4D4D; } \ No newline at end of file diff --git a/JS_Basic_Challenges/4-DOM-pig-game/starter/app.js b/JS_Basic_Challenges/4-DOM-pig-game/starter/app.js new file mode 100755 index 0000000..eb53972 --- /dev/null +++ b/JS_Basic_Challenges/4-DOM-pig-game/starter/app.js @@ -0,0 +1,91 @@ +/* +GAME RULES: + +- The game has 2 players, playing in rounds +- In each turn, a player rolls a dice as many times as he whishes. +- Each result get added to his ROUND score +- BUT, if the player rolls a 1, all his ROUND score gets lost. +- After that, it's the next player's turn +- The player can choose to 'Hold', which means that his ROUND score gets added to his GLOBAL score. After that, it's the next player's turn +- The first player to reach 100 points on GLOBAL score wins the game + +*/ + +var totalScore, currentScore, activePlayer; + +var totalScore = [0,0]; // the total score each player has, added together, after multiple rounds of rolling the dice +var currentScore = 0; // the score each player has per round/ session, when it's they're actively rolling the dice +var activePlayer = 0; // the player that is currently rolling the dice (can either be 0 or 1) + +// Setting a value +// Use the 'querySelector' method to select and change the value of the html element with the id starting with "current-". +// The 'textContent' property sets the text content of the node you specify. In our case, that's the dice value of the player rolling it. +// Use concatenation (+) to create a dynamic class; the player can either be 0 (id="current-0") or 1 (id="current-1"). +// document.querySelector('#current-' + activePlayer).textContent = dice; +// Longer version: document.querySelector('#current-' + activePlayer).textContent = Math.floor(Math.random() * 6) + 1; + +// Getting a value +// Read the value or the content of the element with this id (id="score-0"), and then store it into variable x. +// var x = document.querySelector('#score-0').textContent; + +// Change the style of the dice using the style method and selecting the '.dice' class +// The dice is now hidden when user first loads the page and hasn't started rolling the dice yet. +document.querySelector('.dice').style.display = 'none'; + +document.getElementById('score-0').textContent = '0'; +document.getElementById('score-1').textContent = '0'; +document.getElementById('current-0').textContent = '0'; +document.getElementById('current-1').textContent = '0'; + + +// Add the event listener to the button that rolls the dice, using the .addEventListener method +// The event listener controls (through a function) what happens when the user clicks on the 'roll dice' button. +document.querySelector('.btn-roll').addEventListener('click', function(){ + + // 1. Create a random number from 1 to 6 (included) that imitates throwing a dice. + + // The .random method generates a number from 0 to 1 (ex: 0.5678) + // The .floor method rounds a number downwards to it's nearest integer (ex: from 2.3 to 2) + var dice = Math.floor(Math.random() * 6) + 1; + + // 2. Display the result on the page. + + // Select the .dice class from the DOM and store it in a variable. + var diceDOM = document.querySelector('.dice'); + + // Make it visible again (the dice is initially hidden). + diceDOM.style.display = 'block'; + + // Display the correct number (from 1 to 6), depending on which dice value the user gets. + // Set a different png for every dice value from 1 to 6. + // The src property sets the value of the src attribute of our png. + diceDOM.src = 'dice-' + dice + '.png'; + + // 3. Update the new value after rolling the dice, as long as the rolled number is NOT 1 (see game rules above). + if (dice !== 1) { + // If the dice value is NOT 1: + // 1. Update the currentScore with the new dice value. + currentScore = currentScore + dice; + // 2. Display the updated currentScore in our UI. + document.querySelector('#current-' + activePlayer).textContent = currentScore; + } else { + // If the dice value is 1: + // 1. Switch to the opposite player. (0 or 1) + activePlayer === 0 ? activePlayer = 1 : activePlayer = 0; + + // 2. Reset the current score to 0, so that next player doesn't inherit the other players last dice value. + // currentScore = 0; + document.getElementById('current-0').textContent = '0'; + document.getElementById('current-1').textContent = '0'; + + // 3. Change the style of the card when the player is active. The style has switch between the 2 players. + // The 'classList' property is useful to add, remove and toggle CSS classes on an element. + // Remove the 'active' class that is initially set by default to player 0. + document.querySelector('.player-0-panel').classList.remove('active'); + // Remove the 'active' class that is initially set by default to player 0. + document.querySelector('.player-1-panel').classList.add('active'); + } +}); + +// document.querySelector('#current-' + activePlayer).textContent = dice; +// var x = document.querySelector('#score-0').textContent; diff --git a/JS_Basic_Challenges/4-DOM-pig-game/starter/back.jpg b/JS_Basic_Challenges/4-DOM-pig-game/starter/back.jpg new file mode 100755 index 0000000..dcd9a7d Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/starter/back.jpg differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-1.png b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-1.png new file mode 100755 index 0000000..0d911ca Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-1.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-2.png b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-2.png new file mode 100755 index 0000000..f3c32af Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-2.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-3.png b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-3.png new file mode 100755 index 0000000..e3ef2b5 Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-3.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-4.png b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-4.png new file mode 100755 index 0000000..0c785f7 Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-4.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-5.png b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-5.png new file mode 100755 index 0000000..b4b41e3 Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-5.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-6.png b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-6.png new file mode 100755 index 0000000..6f4d9b3 Binary files /dev/null and b/JS_Basic_Challenges/4-DOM-pig-game/starter/dice-6.png differ diff --git a/JS_Basic_Challenges/4-DOM-pig-game/starter/index.html b/JS_Basic_Challenges/4-DOM-pig-game/starter/index.html new file mode 100755 index 0000000..c4f31cb --- /dev/null +++ b/JS_Basic_Challenges/4-DOM-pig-game/starter/index.html @@ -0,0 +1,41 @@ + + + + + + + + + Pig Game + + + +
+
+
Player 1
+
43
+
+
Current
+
11
+
+
+ +
+
Player 2
+
72
+
+
Current
+
0
+
+
+ + + + + + Dice +
+ + + + diff --git a/JS_Basic_Challenges/4-DOM-pig-game/starter/style.css b/JS_Basic_Challenges/4-DOM-pig-game/starter/style.css new file mode 100755 index 0000000..52cb800 --- /dev/null +++ b/JS_Basic_Challenges/4-DOM-pig-game/starter/style.css @@ -0,0 +1,154 @@ +/********************************************** +*** GENERAL +**********************************************/ + +* { + margin: 0; + padding: 0; + box-sizing: border-box; + +} + +.clearfix::after { + content: ""; + display: table; + clear: both; +} + +body { + background-image: linear-gradient(rgba(62, 20, 20, 0.4), rgba(62, 20, 20, 0.4)), url(back.jpg); + background-size: cover; + background-position: center; + font-family: Lato; + font-weight: 300; + position: relative; + height: 100vh; + color: #555; +} + +.wrapper { + width: 1000px; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: #fff; + box-shadow: 0px 10px 50px rgba(0, 0, 0, 0.3); + overflow: hidden; +} + +.player-0-panel, +.player-1-panel { + width: 50%; + float: left; + height: 600px; + padding: 100px; +} + + + +/********************************************** +*** PLAYERS +**********************************************/ + +.player-name { + font-size: 40px; + text-align: center; + text-transform: uppercase; + letter-spacing: 2px; + font-weight: 100; + margin-top: 20px; + margin-bottom: 10px; + position: relative; +} + +.player-score { + text-align: center; + font-size: 80px; + font-weight: 100; + color: #EB4D4D; + margin-bottom: 130px; +} + +.active { background-color: #f7f7f7; } +.active .player-name { font-weight: 300; } + +.active .player-name::after { + content: "\2022"; + font-size: 47px; + position: absolute; + color: #EB4D4D; + top: -7px; + right: 10px; + +} + +.player-current-box { + background-color: #EB4D4D; + color: #fff; + width: 40%; + margin: 0 auto; + padding: 12px; + text-align: center; +} + +.player-current-label { + text-transform: uppercase; + margin-bottom: 10px; + font-size: 12px; + color: #222; +} + +.player-current-score { + font-size: 30px; +} + +button { + position: absolute; + width: 200px; + left: 50%; + transform: translateX(-50%); + color: #555; + background: none; + border: none; + font-family: Lato; + font-size: 20px; + text-transform: uppercase; + cursor: pointer; + font-weight: 300; + transition: background-color 0.3s, color 0.3s; +} + +button:hover { font-weight: 600; } +button:hover i { margin-right: 20px; } + +button:focus { + outline: none; +} + +i { + color: #EB4D4D; + display: inline-block; + margin-right: 15px; + font-size: 32px; + line-height: 1; + vertical-align: text-top; + margin-top: -4px; + transition: margin 0.3s; +} + +.btn-new { top: 45px;} +.btn-roll { top: 403px;} +.btn-hold { top: 467px;} + +.dice { + position: absolute; + left: 50%; + top: 178px; + transform: translateX(-50%); + height: 100px; + box-shadow: 0px 10px 60px rgba(0, 0, 0, 0.10); +} + +.winner { background-color: #f7f7f7; } +.winner .player-name { font-weight: 300; color: #EB4D4D; } \ No newline at end of file