/* Copyright (C) 2023 Jan-Dirk van Dingenen */

@import url('https://fonts.googleapis.com/css2?family=Carter+One&display=swap');

html {
    color: #250505;
    background-color: #f2f5f2;
    font-family: 'Carter One', sans-serif;
    --baseSize: 10px;
    background-image: url(img/background.jpg);
    background-size: cover;
    background-blend-mode: color;
}

html.player1 {
    background-color: #f2f5f2;
}

html.player2 {
    background-color: #58a45c;
}

body {
    position: relative;
    margin: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-size: calc(1.55 * var(--baseSize));
}

#game {
    display: flex;
    justify-content: space-evenly;
    position: relative;
    width: calc(190 * var(--baseSize));
    height: calc(100 * var(--baseSize));
    margin: 0 auto;    
}

#grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(12,1fr);
    width: calc(84 * var(--baseSize));
    height: calc(84 * var(--baseSize));
    border: solid 1px #000;
    margin-top: calc(7 * var(--baseSize));
    margin-left: calc(7 * var(--baseSize));
    background-color: #89edac;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url(img/grass2.jpg);
    border-radius: calc(1 * var(--baseSize));
    box-shadow: calc(0.5 * var(--baseSize)) calc(0.5 * var(--baseSize)) calc(0.5 * var(--baseSize)) #0b3a00, calc(0.5 * var(--baseSize)) calc(0.5 * var(--baseSize)) 0 calc(0.25 * var(--baseSize)) #0f3c00;
}

.gridTile {
    box-shadow: inset 0 0 0 1px #000;    
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

.gridTile.dropHighlight {
    box-shadow: inset 0 0 0 1px #000, inset 0 0 calc(0.5 * var(--baseSize)) calc(0.5 * var(--baseSize)) #fffc00;
}

.gridTile.dropHighlight.dropHere {    
    animation-name: droplights;
    animation-duration: 1s;
    animation-iteration-count: infinite;
}

@keyframes droplights {
    0%   {box-shadow: inset 0 0 0 1px #000, inset 0 0 calc(0.5 * var(--baseSize)) calc(0.5 * var(--baseSize)) #fffc00;}
    50%  {box-shadow: inset 0 0 0 1px #000, inset 0 0 calc(0.5 * var(--baseSize)) calc(1 * var(--baseSize)) #fffc00;};
    100% {box-shadow: inset 0 0 0 1px #000, inset 0 0 calc(0.5 * var(--baseSize)) calc(0.5 * var(--baseSize)) #fffc00;} 
}

.critter1 { background-image: url(img/1.svg);}
.critter2 { background-image: url(img/2.svg);}
.critter3 { background-image: url(img/3.svg);}
.critter4 { background-image: url(img/4.svg);}
.critter5 { background-image: url(img/5.svg);}
.critter6 { background-image: url(img/6.svg);}

.dice.critterUnknown:after {
    position: absolute;
    content: "?";
    line-height: calc(10 * var(--baseSize));
    text-align: center;
    width: calc(10 * var(--baseSize));
    height: calc(10 * var(--baseSize));
    color: #a6d74a;
    font-size: calc(7 * var(--baseSize));
    text-shadow: calc(0.1 * var(--baseSize)) calc(0.3 * var(--baseSize)) 0 black;
}

.critterIcon {
    display: inline-block;
    width: calc(6 * var(--baseSize));
    height: calc(6 * var(--baseSize));
    background-position: center;
    background-size: contain;
    pointer-events:none;
}

#diceBlock {
    position:relative;
    width: calc(84 * var(--baseSize));
    height: calc(84 * var(--baseSize));
    margin-top: calc(7 * var(--baseSize));
}

#actionInfo {
    height: calc(14 * var(--baseSize));
    text-align: center;
    line-height: calc(6 * var(--baseSize));
    text-shadow: 0 1px 1px lime;
    font-size: calc(2 * var(--baseSize));
}

.actionButtons {
    display: flex;
    justify-content: space-evenly;
}

#diceRolled {
    display: flex;
    justify-content: center;
    height: calc(10 * var(--baseSize));
}

.spinner:first-child {
    border-left: solid 5px rgb(0 0 0 / 80%);
}
.spinner {
    position: relative;
    height: calc(10 * var(--baseSize));
    width: calc(10 * var(--baseSize));
    overflow: hidden;
    border-right: solid 5px rgb(0 0 0 / 80%);
}

.addTileWheel.spinner {
    overflow: visible;
    height: calc(70 * var(--baseSize));
    background-color: #ffffd8;
}

.addTileWheel.spinner .dice {
    text-align: center;
    line-height: calc(10 * var(--baseSize));
    font-size: calc(7 * var(--baseSize));
}

.addTileWheel.spinner .dice:not(.numberDice):hover {
    cursor: pointer;
    background-color: #caeb5c;
    box-shadow: inset 0 0 calc(4 * var(--baseSize)) #29b700;
}

.spinner:before {
    content: "";
    position: absolute;
    height: calc(1.5 * var(--baseSize));
    width: 100%;
    pointer-events: none;
    background: #000;
    background: linear-gradient(to bottom, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%);
    z-index: 1;
}

.spinner:after {
    content: "";
    position: absolute;
    bottom: 0;
    height: calc(1.5 * var(--baseSize));
    width: 100%;
    pointer-events: none;
    background: #000;
    z-index: 1;
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%);
}

.spinroll {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(calc(-100% + (var(--baseSize) * 10)));
    transition: transform 2s ease-in-out;
}

.spin .spinroll {
    transform: translateY(0);
}

.spinblur .dice {
    filter:blur(1px);
}

#diceScored {
    position:relative;
    display: flex;
    flex-wrap: wrap;
}

.dice {
    width: calc(10 * var(--baseSize));
    height: calc(10 * var(--baseSize));
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    background-color: ivory;
}

.spinroll .dice:not(.critterUnknown):hover {
    cursor: pointer;
    background-color: #caeb5c;
    box-shadow: inset 0 0 calc(4 * var(--baseSize)) #29b700;
}

.diceScored {
    width: calc(10 * var(--baseSize));
    height: calc(10 * var(--baseSize));
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

.dice.numberDice {
    text-shadow: 1px calc(0.2 * var(--baseSize)) 0px #ddf07f;
    cursor:default;
}

.gridTile.owner1 {
    background-color: #ffffff8c;    
}

.gridTile.owner2 {
    background-color: #2020208c;
}

.dice.owner1 {
    background-color: ivory;    
}

.dice.owner2 {
    background-color: #989899;    
}

#score {
    position: absolute;
    display: flex;
    top: calc(0.5 * var(--baseSize));
    left: calc(40.7 * var(--baseSize));
    justify-content: space-between;
    font-size: calc(2.5 * var(--baseSize));
    width: calc(26.5 * var(--baseSize));
    cursor:default;
}

#score .playerColor1 {
    background-color: ivory;
    padding: calc(1 * var(--baseSize)) calc(2 * var(--baseSize));
    color: #2c2c28;
    border-radius: calc(0.25 * var(--baseSize));
    box-shadow: 1px 1px 1px #000;
}

#score .playerColor2 {
    background-color: #2c2c28;
    padding: calc(1 * var(--baseSize)) calc(2 * var(--baseSize));
    color: ivory;
    border-radius: calc(0.25 * var(--baseSize));
    box-shadow: 1px 1px 1px #fff;
}

.button, .menuOption {
    position:relative;
    background-image: url(img/button.png?);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    width: calc(15 * var(--baseSize));
    height: calc(5 * var(--baseSize));
    line-height: calc(5 * var(--baseSize));
    text-align: center;
    color: white;
    text-shadow: 0 2px 2px #000;
    font-size: calc(2 * var(--baseSize));
    transition:all 0.25s;
    cursor:pointer;
}

.button:hover, .menuOption:hover {
    filter: brightness(1.2);
}

.button:active, .menuOption:active {
    filter: brightness(1.2);
    height: calc(4.95 * var(--baseSize));
    transform: translate(0, calc(0.1 * var(--baseSize)));
}

.inactive {
    filter: grayscale(0.5);
    opacity: 0.8;
}

.inactive.active {
    filter: grayscale(0);
    opacity: 1;
}

.errorHelp {
    color: #a00;
    text-shadow: 0 1px 1px pink;
}

.popup {
    position: absolute;
    font-size: calc(1.5 * var(--baseSize));
    font-family: monospace;
    text-shadow: none;
    background-color: #303030;
    line-height: initial;
    transition: all 0.2s;
    width: calc(25 * var(--baseSize));
    display: block;
    font-style: normal;
    text-align: center;
    font-weight: normal;
    max-width: max-content;
    pointer-events: none;
    opacity: 1;
    left: 50%;
    transform: translate(-50%, -100%);
    top: calc(-1 * var(--baseSize));
    padding: calc(1 * var(--baseSize));
    border-radius: calc(0.5 * var(--baseSize));
    box-shadow: inset 0 0 1px 1px ivory, calc(0.5 * var(--baseSize)) calc(0.5 * var(--baseSize)) calc(0.5 * var(--baseSize)) #00000085;
}

.popup:after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    left: 50%;
    transform: translate(-50%, 100%);
    bottom: 0;
    z-index: 100;
    border-style: solid;
    border-width: calc(0.7 * var(--baseSize)) calc(1 * var(--baseSize)) 0 calc(1 * var(--baseSize));
    border-color: #ffffff transparent transparent transparent;
}

#actionInfo .critterIcon {
    transform: translate(0, calc(1.5 * var(--baseSize)));
}

#actionInfo .critterIcon.critter1, #actionInfo .critterIcon.critter4 {
    transform: translate(0, calc(1 * var(--baseSize)));
}

.gameover {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    font-size: calc(1000 * var(--baseSize));
    white-space: nowrap;
    text-shadow: calc(10 * var(--baseSize)) calc(10 * var(--baseSize)) calc(10 * var(--baseSize));
    animation-name: gameoverzoom;
    animation-duration: 3s;
    animation-fill-mode: forwards;
    animation-timing-function: ease-out;
    pointer-events: none;
}

.player1 .gameover {
    color: rgb(220, 255, 220);
    --shadeColor: #000;
}

.player2 .gameover {
    color: rgb(5, 37, 5);
    --shadeColor: #fff;
}

@keyframes gameoverzoom {
    0%   {
        font-size: calc(1000 * var(--baseSize));
        text-shadow: calc(10 * var(--baseSize)) calc(10 * var(--baseSize)) calc(10 * var(--baseSize));        
    }
    50% {
        font-size: calc(5 * var(--baseSize));
        text-shadow: calc(0.1 * var(--baseSize)) calc(0.1 * var(--baseSize)) calc(0.1 * var(--baseSize)) var(--shadeColor);
    } 
    100% {
        font-size: calc(25 * var(--baseSize));
        text-shadow: calc(0.5 * var(--baseSize)) calc(0.5 * var(--baseSize)) calc(0.5 * var(--baseSize)) var(--shadeColor);
    }  
}

#playerName {
    position: absolute;
    top: 0;
    right: 0;
    margin: calc(0.75 * var(--baseSize)) calc(1.5 * var(--baseSize));
    font-size: calc(2 * var(--baseSize));
    cursor:pointer;
}

#menu, .waitMessage, #howtoplay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -75%);
    background-color: #a8a8a8;
    padding: calc(2 * var(--baseSize));
    box-shadow: calc(1.5 * var(--baseSize)) calc(1.5 * var(--baseSize)) calc(3 * var(--baseSize)) #000, inset 0 0 calc(2 * var(--baseSize)) #6a6a6a;
    border-radius: calc(0.75 * var(--baseSize));
    width: calc(80 * var(--baseSize));
    background-image: url(img/grass2.jpg);
    background-blend-mode: hard-light;
    border: solid 1px #000000ab;
}

.waitMessage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -100%);
    width: calc(50 * var(--baseSize));
    border: solid 1px #96f63f;
}

.menuOptionWrapper {
    display: flex;
}

.copyLinkWrap {
    display: flex;
}

input.waitUrl {
    width: calc(100% - calc(2 * var(--baseSize)));
}

.waitUrlCopyButton {
    width: calc(2 * var(--baseSize));
    height: calc(2 * var(--baseSize));
    background-image: url(img/clipboard.svg);
    background-size: contain;
    margin-left: calc(1 * var(--baseSize));
    cursor: pointer;
}

.waitUrlCopyButton:hover {
    filter: invert(1);
}

.movingCritter {
  position: relative;
  transform: translate(-25%,-25%);
}

#multiTurn {
    position: absolute;
    top: calc(1 * var(--baseSize));
    left: calc(101 * var(--baseSize));
    font-size: calc(2.5 * var(--baseSize));
    width: calc(84 * var(--baseSize));
    cursor: default;
    text-align: center;
}

#menuErrors {
    color: #a00;
}

.screenShake {
  animation: shake 0.2s; 
}

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(0deg); }
  20% { transform: translate(-3px, 0px) rotate(0deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(0deg); }
  50% { transform: translate(-1px, 2px) rotate(0deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(0deg); }
  80% { transform: translate(-1px, -1px) rotate(0deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(0deg); }
}

.menuOptionWrapper {
    display: flex;
    align-items: center;
}

waitMessage .menuOption {
    width: calc(18 * var(--baseSize));
    margin: calc(1 * var(--baseSize));
}

input#joinInput {
    height: calc(3 * var(--baseSize));
}

#menu h1 {
    text-align: center;
    font-size: calc(6 * var(--baseSize));
    margin: calc(2 * var(--baseSize)) 0 0 0;
    text-shadow: calc(0.3 * var(--baseSize)) calc(0.3 * var(--baseSize)) 0 #50803f, 0 0 calc(0.4* var(--baseSize)) yellow;
}

#subTitle {
    width: calc(80 * var(--baseSize));
    text-align: center;
    margin-bottom: calc(3 * var(--baseSize));
    box-sizing: border-box;
    padding: 0 calc(10 * var(--baseSize));
}


::selection {
    background: transparent;
}
::-moz-selection {
    background: transparent;
}

.waitUrl::selection, .waitMessage ::selection {
    background: #bce14c;
}
.waitUrl::-moz-selection, .waitMessage::-moz-selection {
    background: #bce14c;
}

.backdropCritter {
    position: absolute;
    top: calc(var(--y) * var(--baseSize));
    left: calc(var(--x) * var(--baseSize));
    transform: translate(-50%, -50%);
    background-size: contain;
    background-repeat: no-repeat;
    width:calc(10 * var(--baseSize));
    height:calc(10 * var(--baseSize));
    scale:var(--scale);   
}

.backdropCritter1 { background-image: url(img/1.svg); }
.backdropCritter2 { background-image: url(img/2.svg); }
.backdropCritter3 { background-image: url(img/3.svg); }
.backdropCritter4 { background-image: url(img/4.svg); }
.backdropCritter5 { background-image: url(img/5.svg); }
.backdropCritter6 { background-image: url(img/6.svg); }

#howtoplay {
    display:none;
    background-color: #bfd0b7;
    width: calc(100 * var(--baseSize));
    background-image: url(img/background.jpg);
    transform: translate(-50%,-50%) !important;
    z-index:10;
}

#menuHelpClose {
    position: absolute;
    top: calc(0.55 * var(--baseSize));
    right: calc(1.55 * var(--baseSize));
    cursor: pointer;
}

#menuHelpClose:hover {
    text-decoration: underline;
}