/*
 Copyright (C) 2019 Jan-Dirk van Dingenen
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/  

@import url('https://fonts.googleapis.com/css?family=Galindo');

* {
    -ms-touch-action: none;   /* for windows surface */
}

body {
    background-color: #63494A;
    margin: 0;
    font-family: 'Galindo', cursive;    
    background-image: url(img/backTile.jpg);
    background-size: 5%;
    background-repeat: repeat;
    position: relative;
}

#game {
    --tileSize : 4.7vh;
    padding: 0 calc(var(--tileSize) * 0.1);
    min-width:  calc(var(--tileSize) * 30);
}

#game.computer {
    pointer-events: none;
}

#factories {
    padding: calc(var(--tileSize) * 0.45) 0;
    display: flex;
    justify-content: space-around;
}

#players {
    display: flex;
    justify-content: space-between;
    height: calc(100vh - calc(var(--tileSize) * 4));
}

#playersLeft, #playersRight {
    display: inline-flex;
    flex-direction: column;
}

.playerInfo {
    width: 100%;
    text-align: center;
    font-size: calc(var(--tileSize) * 0.5);
    margin-top: calc(var(--tileSize) * -0.1);
    position:relative;
}

#center {
    position: relative;
    width: 100%;
    height: calc(100% - var(--tileSize) * 1);
    box-sizing: border-box;
    padding: calc(var(--tileSize) * 0.5);
    margin: calc(var(--tileSize) * 0.5);
    min-width: calc(var(--tileSize) * 3.5);
    border-radius: calc(var(--tileSize) * 0.5);
}

#center:before {
    position: absolute;
    content: "ROJO";
    color: rgba(255, 255, 255, 1);
    font-size: calc(var(--tileSize) * 2);
    top: 0;
    padding-top: calc(var(--tileSize) * 2);
    left: 50%;
    height: 100%;
    width: calc(var(--tileSize) * 2);
    text-align: center;
    word-wrap: break-word;
    font-weight: 900;
    transform: translate(-50%,0);
    box-sizing: border-box;
    transition: all 1s;
}

#game.intro #center:before {
    left: 5%;
    font-size: calc(var(--tileSize) * 3);
    padding-top: 0;
}

#center .tile {
    margin: calc(var(--tileSize) * 0.1);
}

.player {
    display: inline-block;
}

#player1, #player1 .board, #player3, #player3 .board {
    float: right;
}

.board {
    background: #f6f4fb;
    border-radius: calc(var(--tileSize) * 0.2);
    padding: calc(var(--tileSize) * 0.2);
    margin: calc(var(--tileSize) * 0.2) calc(var(--tileSize) * 0.1);
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.75));
    width: calc(var(--tileSize) * 13);
}

.player.activePlayer .board {
    background-image: url(img/board.jpg);
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

.boardWall, .boardLines {
    display: inline-block;
}

.boardLine, .wallLine {
    display:flex;
}

.boardLine {
    position: relative;
    flex-flow: row-reverse;
    margin-right: calc(var(--tileSize) * 1);
}

.boardLine:after {
    content: "";
    width: calc(var(--tileSize) * 0.7);
    height: calc(var(--tileSize) * 0.7);
    position: absolute;
    right: calc(var(--tileSize) * -0.8);
    top: calc(var(--tileSize) * 0.3);
    background-image: url(img/arrow.png);
    background-size: contain;
}

/*.boardLine:before {
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: calc(var(--tileSize) * 0.5) 0 calc(var(--tileSize) * 0.5) calc(var(--tileSize) * 0.5);
    border-color: transparent transparent transparent #de9691;
    position: absolute;
    right: calc(var(--tileSize) * -0.75);
    top: calc(var(--tileSize) * 0.1);
}

.boardLine:after {
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: calc(var(--tileSize) * 0.2) 0 calc(var(--tileSize) * 0.2) calc(var(--tileSize) * 0.2);
    border-color: transparent transparent transparent rgba(175, 47, 31, 0.5);
    position: absolute;
    right: calc(var(--tileSize) * -0.56);
    top: calc(var(--tileSize) * 0.4);
}*/

.overflowLine {
    display: flex;
    margin-top: calc(var(--tileSize) * 0.3);
}

.overflowPoints {
    background-color: #F0F0F0;
    text-align: center;
    width: calc(var(--tileSize) * 0.5);
    position: absolute;
    left: 50%;
    transform: translate(-50%,0);
    border-radius: 50% 50% 0 0;
    padding-top: calc(var(--tileSize) * 0.06);
    z-index: 2;
    top: calc(var(--tileSize) * -0.09);
    border: solid calc(var(--tileSize) * 0.03) #a0a0a0;
    border-bottom: none;
    font-family: monospace;
    font-size: calc(var(--tileSize) * 0.3);
    box-shadow: inset 2px 1px 0px 1px rgba(0, 0, 0, 0.53);
}

.overflow {
    position: relative;
}

.overflow .lineTile {
    margin-top: calc(var(--tileSize) * 0.3);
    margin-bottom: 0;
    background: #F0F0F0;
    border: solid calc(var(--tileSize) * 0.03) #a0a0a0;
    box-shadow: inset 1px 0px 0px 1px rgba(0, 0, 0, 0.53);
}

.tile {
    border: none;
    width: var(--tileSize);
    height: var(--tileSize);
    box-sizing: border-box;
    position:relative;
    border-radius: calc(var(--tileSize) * 0.1);
    display:inline-block;
    background-color: white;
    -webkit-transform: translateZ(0);
}

.lineTile {
    margin: calc(var(--tileSize) * 0.1);
}

#game .tile.tileFilled_true {
    border: outset calc(var(--tileSize) * 0.06);
    filter: drop-shadow(3px 3px 1px rgba(0,0,0,0.75));
}

#game .boardWall .tile.tileFilled_true {
    border: outset calc(var(--tileSize) * 0.06) #515151;
}

.tileFilled_false:after {
    content:"";
    position:absolute;
    top:0px;
    left:0px;
    width: var(--tileSize);
    height: var(--tileSize);
    background-color:rgba(255,255,255,0.5);
}

.boardLine .lineTile {
    border: solid calc(var(--tileSize) * 0.03) #a0a0a0;
    box-shadow: inset 1px 1px 1px 1px rgba(0, 0, 0, 0.53);
}

.tile.blue {
    background-image: url(img/blue.jpg);
    background-size: contain;
    background-repeat: no-repeat;
}

.tile.rojo {
    background-image: url(img/red.jpg);
    background-size: contain;
    background-repeat: no-repeat;
}

.tile.black {
    background-image: url(img/black.jpg);
    background-size: contain;
    background-repeat: no-repeat;
}

.tile.yellow {
    background-image: url(img/yellow.jpg);
    background-size: contain;
    background-repeat: no-repeat;
}

.tile.white {
    background-image: url(img/white2.jpg);
    background-size: contain;
    background-repeat: no-repeat;
}

.tile.first {
    background-image: url(img/first.jpg);
    background-size: cover;
    background-repeat: no-repeat;
}

.lineTile.tileFilled_false {
    border: solid calc(var(--tileSize) * 0.03) #e0e0e0;
}

.factory {
    display: inline-grid;
    grid-template-rows: var(--tileSize) var(--tileSize);
    grid-template-columns: var(--tileSize) var(--tileSize);
    padding: calc(var(--tileSize) * 0.5);
    border-radius: 50%;
    filter: drop-shadow(2px 3px 2px rgba(77, 21, 14,1));
    background-image: url(img/factoryTile.jpg);
    background-size: cover;
}


.tileDragger {
    position:absolute;     
}

.tileDragger .tile {
    display:inline-block;
    margin-left:calc(var(--tileSize) * -0.5);
}

.tileDragger .tile:nth-child(2) {transform: translate(0, calc(var(--tileSize) * 0.25));}
.tileDragger .tile:nth-child(3) {transform: translate(0, calc(var(--tileSize) * 0.5));}
.tileDragger .tile:nth-child(4) {transform: translate(0, calc(var(--tileSize) * 0.75));}
.tileDragger .tile:nth-child(5) {transform: translate(0, calc(var(--tileSize) * 1));}
.tileDragger .tile:nth-child(6) {transform: translate(0, calc(var(--tileSize) * 1.25));}
.tileDragger .tile:nth-child(7) {transform: translate(0, calc(var(--tileSize) * 1.5));}
.tileDragger .tile:nth-child(8) {transform: translate(0, calc(var(--tileSize) * 1.75));}
.tileDragger .tile:nth-child(9) {transform: translate(0, calc(var(--tileSize) * 2));}
.tileDragger .tile:nth-child(10) {transform: translate(0, calc(var(--tileSize) * 2.25));}
.tileDragger .tile:nth-child(11) {transform: translate(0, calc(var(--tileSize)* 2.5));}


.dropHighlight .tile:not(.tileFilled_true), .dropHighlight .overflowPoints{
    box-shadow:0 0 2px #0A0;
}

.dropHere.dropHighlight .tile:not(.tileFilled_true), .dropHere.dropHighlight .overflowPoints {
    background-color: #D8FBDD;
}

.endRoundTile {
    position: absolute;
    box-shadow: 7px 7px 7px rgba(0,0,0,0.5);
}

#gameover {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translate(-50%,-50%);
    color: #202020;
    background: #fff5f5;
    padding: calc(var(--tileSize) *1);
    border-radius: calc(var(--tileSize) *0.3);
    font-size: calc(var(--tileSize) *2);
    box-sizing: border-box;
    border: solid 1px #de9691;
    box-shadow: calc(var(--tileSize) *0.5) calc(var(--tileSize) *0.5) calc(var(--tileSize) *1) #000;
    white-space: nowrap;
    text-shadow: 2px 2px 2px #de9691;
}

#gameover .smallGameover {
    text-align: center;
    font-size: calc(var(--tileSize) *1);
}

@keyframes shake {
     0% { transform: translate(2px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(0px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(2px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(2px, 2px) rotate(0deg); }
   100% { transform: translate(1px, -2px) rotate(-1deg); }
}


#intro {
    display: none;
    position: absolute;
    top: calc(var(--tileSize)* 2);
    left: 50%;
    transform: translate(-50%,0);
    padding: var(--tileSize);
    font-size: var(--tileSize);
    color: #333333;
    grid-template-columns: auto auto;
    grid-column-gap: var(--tileSize);
    line-height: calc(var(--tileSize) *3);
    white-space: nowrap;
}

.intro #intro {
    display: grid;
    border-radius: calc(var(--tileSize)* 0.5);
    border: solid 1px rgba(255,255,255,0.3);
    background-image: url(img/board.jpg);
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

select {
    font-size: var(--tileSize);
    font-family: 'Galindo', cursive;
    background-color: #333333;
    color:#f0f0f0;
    border: 0;
    outline: none;
    border-radius: 10% 10% 0 0;
    padding: 0 calc(var(--tileSize) *0.5);
}

button {
    font-size: var(--tileSize);
    font-family: 'Galindo', cursive;
    padding: calc(var(--tileSize) *0.25) calc(var(--tileSize) *0.75);
    border-radius: calc(var(--tileSize) *0.25);
    background: linear-gradient(rgba(250,90,90,1) 0%, rgba(232,81,81,1) 100%);
    color: white;
    position: relative;
    border: 1px solid rgba(0,0,0,0.21);
    border-bottom: 4px solid rgba(0,0,0,0.21);
    text-shadow: 0 1px 0 rgba(0,0,0,0.15);
    outline:none;
    cursor:pointer;
    transition: 0.5s all;
}

button:hover {
    transform: scale(1.1,1.1);
}

button:active {
    background: #E35252;
}

#again {
    text-align: center;
    margin-top: calc(var(--tileSize) *0.5);
}

input#playerName {
    width: calc(var(--tileSize) *5);
    height: calc(var(--tileSize) *1);
    font-size: calc(var(--tileSize) *0.75);
    padding: calc(var(--tileSize) *0.2);
    border: solid calc(var(--tileSize) *0.05) #333333;
    color: #333333;
    border-radius: calc(var(--tileSize) *0.1);
    outline-color: #63494a;
}

#highscores {
    position: absolute;
    top: 5px;
    right: 10px;
    text-decoration: underline;
    cursor:pointer;
    display:none;
}

#game.intro #highscores, #game.intro #others {
    display:block;
}

#highscores:hover {
    color:#fff;
}

#scoreModal {
    display: grid;
    border-radius: calc(var(--tileSize) * 0.5);
    border: solid 1px rgba(255,255,255,0.3);
    background-image: url(img/board.jpg);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    position: absolute;
    top: calc(var(--tileSize)* 1);
    left: 50%;
    transform: translate(-50%,0);
    padding: var(--tileSize);
    font-size: calc(var(--tileSize) * 0.5);
    color: #333333;
    grid-template-columns: auto auto auto;
    grid-column-gap: calc(var(--tileSize) * 1.3);
    line-height: calc(var(--tileSize) * 0.75);
    z-index: 10000;
    box-shadow: calc(var(--tileSize) * 0.5) calc(var(--tileSize) * 0.5) calc(var(--tileSize) * 1) #000;
}

::selection, button::selection {
  background: transparent;
}
::-moz-selection, button::-moz-selection {
  background: transparent; 
}

input::selection {
  background: #EF5555;
  color:#fff;
}
input::-moz-selection {
  background: #EF5555; 
  color:#fff;
}

#scoreModal #close {
    position: absolute;
    top: calc(var(--tileSize) * 0.25);
    right: calc(var(--tileSize) * 0.25);
    text-decoration: underline;
    font-size: calc(var(--tileSize) * 0.3);
    cursor: pointer;
    color: #fff;
    padding: calc(var(--tileSize) * 0.1) calc(var(--tileSize) * 0.3);
    background-color: #F45757;
    border-radius: calc(var(--tileSize) * 0.1);
    transition: all 0.5s;
}

#scoreModal #close:hover {
    color:#000;
    background-color: #F1B2A9;
}

#scoreModal .scoreMode {
    display: grid;
    grid-template-columns: auto auto auto;
    grid-column-gap: calc(var(--tileSize) *0.2);
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(var(--tileSize) * 15.7);
}

#scoreModal .scoreTitle {
    text-align: center;
    font-size: calc(var(--tileSize) * 0.9);
    white-space: nowrap;
    margin: calc(var(--tileSize) *0.25) 0;
    padding: calc(var(--tileSize) * 0.45);
    background-color: #f256561c;
    color: #000000;
    border-radius: calc(var(--tileSize) * 0.2);
}

#scoreModal .highRank, #scoreModal .highScore {
    text-align: right;
    padding-right: calc(var(--tileSize) * 0.3);
}

#scoreModal .highRank {
    padding-right: calc(var(--tileSize) *0.5);
}

.high0 {
    color: #f45757;
    text-shadow: 1px 1px #000;
}

#others {
    position: absolute;
    top: 0px;
    top: 5px;
    left: 10px;
    font-size: 80%;
    display:none;
}

#others a {
    color:#000;   
}

#others a:hover {
    color:#fff;
}

.basic .tile.blue {
    background-image: none;
    background-color:#00a;
}

.basic .tile.rojo {
    background-image: none;
    background-color:#a00;
}

.basic .tile.black {
    background-image: none;
    background-color:#000;
}

.basic .tile.yellow {
    background-image: none;
    background-color:#aa0;
}

.basic .tile.white {
    background-image: none;
    background-color:#aaa;
}

.basic .tile.first {
    background-image: none;
    background-color:#0a0;
}
.basic .tile.first:before {
    content:"1";
    color:#fff;
    text-align: center;
}

.scoringInfo {
    display: none;
    position: absolute;
    bottom: 0;
    right: 0;
    width: calc(var(--tileSize) * 5);
    height: calc(var(--tileSize) * 5);
    z-index: 10001;
    overflow-y: scroll;
    overflow-x: hidden;
    white-space: nowrap;
    background: #f6f4fb;
    border-radius: calc(var(--tileSize) * 0.2);
    padding: calc(var(--tileSize) * 0.2);
    padding-left: calc(var(--tileSize) * 0.4);
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.75));
    background-image: url(img/board.jpg);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    font-size: calc(var(--tileSize) * 0.3);
    text-align: left;
     -webkit-overflow-scrolling: touch;
}

.playerInfo:hover .scoringInfo, .playerInfo:active .scoringInfo {
    display:block;
}

span.tile.tinyTile {
    width: calc(var(--tileSize) * 0.3);
    height: calc(var(--tileSize) * 0.3);
}

select.disabled {
    background-color: rgb(128, 128, 128);
}

::-webkit-scrollbar {
    width: calc(var(--tileSize) * 0.2);
}

::-webkit-scrollbar-thumb {
    border-radius: calc(var(--tileSize) * 0.2);
    background: rgb(239, 182, 176);
    box-shadow: inset 0 0 calc(var(--tileSize) * 0.1) rgba(0,0,0,0.5);
}

::-webkit-scrollbar-track {
    box-shadow: inset 0 0 calc(var(--tileSize) * 0.2) rgba(0,0,0,0.3);
    border-radius: calc(var(--tileSize) * 0.2);
}

.scoreMode:hover::-webkit-scrollbar {
    display: block;
}
.scoreMode::-webkit-scrollbar {
    display: none;
}