 /**************************************************
 GENERAL 
 ***************************************************/
 * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

*:focus {
    outline: none;
}

:root {
    --color-square: #cfedfb;
    --color-tile: #f6cd97;
    --color-rack: #744911;
    --color-dl: #30abcc;
    --color-dw: #f04e52;
    --color-tl: #45ce5d;
    --color-tw: #fa732b;
    --color-tile-text: #000;
    --color-square-text: #fff;

    --size-square: 36px;
    --size-square-gap: 3px;
    --size-tile: 53px;

    --font-stack: Roboto, sans-serif;
    --font-size: calc(0.35 * var(--size-square));
}

html {
    font-family: var(--font-stack);
}

body {
    background-color: #e9d8a6;
}

 /**************************************************
 LAYOUT
 ***************************************************/
.intro-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.main-page {
    display: flex;
    justify-content: space-between;
    padding: 25px;
}

.game-area {
    margin: 0 auto;
    position: relative;
}

.stats-area {
    display: grid;
    grid-template-areas: "title title"
                         "player1 player2"
                         "player3 player4"
                         "words words";
    gap: 25px;
    margin: 0 auto;
}

.stats-area > .title {
    grid-area: title;
    justify-content: center;
}

/**************************************************
INTRO PAGE
***************************************************/
.title {
    display: flex;
    gap: 8px;
    font-size: 30px;
    margin-bottom: 20px;
    transition: all 0.3s ease-in-out;
}

.title .tile:hover {
    transform: translateY(-6px);
}

.game-setup {
    background: linear-gradient(#cfedfbe0, #cfedfbf1), url('../img/board.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 700px;
    height: 500px;
    padding: 20px 0;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 20px;
}

.player-num {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 20px;
}

.instructions {
    flex: 1;
    display: flex;
    align-items: center;
}

.player-names {
    flex: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.player-input {
    padding: 7px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.player-icons img {
    width: 35px;
    border-radius: 50%;
    margin: 0 10px;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

.player-icons img:hover {
    transform: scale(1.1);
}

input,
#numPlayers {
    padding: 10px 15px;
    border-radius: 10px;
}

#startGame {
    background-color: var(--color-tl);
    padding: 15px 45px;
    font-size: 20px;
    text-transform: uppercase;
}

 /**************************************************
 BOARD 
 ***************************************************/
 .board {
    width: 100%;
    display: grid;
    grid-template-rows: repeat(15, var(--size-square));
    grid-template-columns: repeat(15, var(--size-square));
    gap: var(--size-square-gap);
    justify-content: center;
    margin: 0 auto;
    user-select: none;
    position: relative;
}

.square {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--color-square); 
    color: var(--color-square-text);
    font-size: var(--font-size);
    text-transform: uppercase;
    border-radius: 5px;
    position: relative;
    box-shadow: rgba(0, 0, 0, 0.06) 0px 2px 4px 0px inset;
}

.square--dl {
    background-color: var(--color-dl);
}

.square--dw {
    background-color: var(--color-dw);
}

.square--tl {
    background-color: var(--color-tl);
}

.square--tw {
    background-color: var(--color-tw);
}

 /**************************************************
 * TILE RACKS
 ***************************************************/
.controls {
    display: grid;
    gap: 5px;
    grid-template-areas: "tiles btnMain"
                         "btnGroup btnMain";
    background-color: var(--color-square);
    background-color: rgba(0, 0, 0, 0.623);
    border-radius: 10px;
    padding: 15px;
    margin-top: 5px;
    box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.14) , 0px 3px 1px -2px rgba(0,0,0,0.12) , 0px 1px 5px 0px rgba(0,0,0,0.2) ;
}

#btnGroup {
    grid-area: btnGroup;
    flex-direction: row;
    justify-content: space-around;
    gap: 5px;
}

#btnMain {
    grid-area: btnMain;
}

.buttons {
    display: flex;
    flex-direction: column;
}

.tile-area {
    width: 100%;
    height: 60px;
    grid-area: tiles;
}

.player-rack {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 5px;
    height: 100%;
}

.player-rack .tile:hover {
    border: 1px solid var(--color-dw);
}

.tile {
    background-color: var(--color-tile);
    color: var(--color-tile-text);
    width: var(--size-tile);
    height: var(--size-tile);
    font-family: inherit;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.3s ease-in;
    box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.14) , 0px 3px 1px -2px rgba(0,0,0,0.12) , 0px 1px 5px 0px rgba(0,0,0,0.2) ;
}

.tile__letter {
    text-transform: uppercase;
    font-size: 1.8em;
}

.tile__point-value {
    position: absolute;
    right: 5px;
    bottom: 5px;
    font-size: 0.7em;
}

/* Shrink tile to fit when on square */
.square .tile {
    position: absolute;
    width: 100%;
    height: 100%;
}

.dragging {
    opacity: 0.7;
    cursor: none;
}

 /**************************************************
 * STATS AREA
 ***************************************************/
 #p1 {
     grid-area: player1;
}

 #p2 {
    grid-area: player2;
}

#p3 {
    grid-area: player3;
}

#p4 {
    grid-area: player4;
}

.player-card {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background-color: var(--color-square);
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
    border-radius: 8px;
    width: 300px;
    transition: all 0.3s ease-in-out;
}

.player-card__img {
    flex: 1;
    padding: 0 20px
}

.player-card__info {
    flex: 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px 0;
    height: 100%;
}

.player-card__name {
    font-size: 26px;
}

.player-card__best-word {
    display: inline-block;
    font: 24px;
    text-transform: uppercase;
}

.player-card__score {
    flex: 1;
    text-align: right;
    font-size: 38px;
    padding-right: 30px;
    font-weight: 700;
    color: var(--color-dw)
}

.active {
    border: 4px solid var(--color-dw);
}

.inactive {
    background-color: rgba(0, 0, 0, 0.657);
    transform: scale(0.9);
    opacity: 0.8;
}

.inactive .player-card__score {
    color: rgba(170, 170, 170, 0.212);
}

 /**************************************************
 * Word Table
 ***************************************************/
::-webkit-scrollbar {
     width: 10px;
} 

::-webkit-scrollbar-track {
    background: rgb(179, 177, 177);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgb(136, 136, 136);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgb(100, 100, 100);

    border-radius: 10px;
}

::-webkit-scrollbar-thumb:active {
    background: rgb(68, 68, 68);
    border-radius: 10px;
}

.wordTable {
    grid-area: words;
    width: 65%;
    height: 200px;
    margin-top: 40px;
    justify-self: center;
    border-radius: 7px;
    overflow-y: auto;
    box-shadow: 0px 2px 2px 0px rgba(0,0,0,0.14) , 0px 3px 1px -2px rgba(0,0,0,0.12) , 0px 1px 5px 0px rgba(0,0,0,0.2);
    background-color: rgba(0, 0, 0, 0.623);
    color: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    position: relative;
    border-spacing: 10px 0;
    position: relative;
}

thead {
    height: 30px;
}

tr th {
    background-color: var(--color-square);
    color: #000;
    padding: 4px 0;
}

tr th:first-child {
    text-align: left;
    padding-left: 20px;
}

th {
    position: sticky;
    top: 0px;
}

tr {
    animation: slideIn 1s;
}

td {
    padding: 8px;
}

.wordList tr:nth-child(even) {
    background-color: var(--color-tile);
    color: #000;
}

.wordList .word {
    text-transform: uppercase;
    padding-left: 20px;
    width: 40%;
}

.wordList .player {
    text-align: center;
    width: 30%;
}

.wordList .score {
    text-align: center;
}

/**************************************************
* BUTTONS
***************************************************/
button {
    font-family: inherit;
    font-size: 16px;
    letter-spacing: 2px;
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 5px;
    background-color: var(--color-dw);
    border: none;
    margin: 3px 0;
    color: #fff;
    transition: all 0.3s ease-in-out;
}

button:hover:not(#tileCount) {
    opacity: 0.8;
}

button:disabled {
    cursor:not-allowed;
}

#playBtn {
    background-color: var(--color-tl);
    height: 65%;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
}

#passBtn {
    background-color: var(--color-dl);
}

#forfeitBtn {
    background-color: var(--color-tw);
}

#tileCount {
    background-color: var(--color-tile);
    padding: 7px;
    font-size: 14px;
    color: #000;
    cursor:default;
    font-weight: 700;
}

/**************************************************
* NOTIFICATION
***************************************************/
.notification-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 134px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.notification-item {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin: 10px auto;
    background-color: #000;
    color: #fff;
    border-radius: 10px;
    padding: 15px 40px;
    letter-spacing: 2px;
    font-size: 18px;
    text-transform: uppercase;
    position: relative;
    z-index: 100;
    width: 60%;
    animation: slideDown 0.6s;
}

.info {
    background-color: #000;
}

.warn {
    background-color: var(--color-tw);
}

.error {
    background-color: var(--color-dw);
}

/**************************************************
* ANIMATIONS
***************************************************/
@keyframes popOut {
    from {
        border: none;
    }

    to {
        border: 2px solid var(--color-tile-text);
        transform: scale(1.5);
        z-index: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-100%);
    } 

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

.pop-out {
    animation: popOut 0.2s forwards;
}


.hidden {
    display: none;
}

