:root {
    --grid-rows: 10;
    --player-one-percent: 0%;
    --winning-player-color: red;
    --background-color: #1a1b12;
    --foreground-color: white;
    --tile-focus-color: #2b2c21;
    --tile-blink-color: #3f4134;
    --player-one-color: #8fdfff;
    --player-two-color: #ffb3b3;
    --modal-color: white;
}

.lightmode {
    --background-color: #eeedf1;
    --foreground-color: rgb(61, 54, 42);
    --tile-focus-color: #cfccc8;
    --tile-blink-color: #e4e1d9;
    --player-one-color: rgb(40, 133, 209);
    --player-two-color: rgb(189, 65, 65);
    --modal-color: #eeedf1;
    font-weight: bold;
}

@keyframes blink {
    from {background-color: var(--tile-focus-color);}
    to {background-color: var(--tile-blink-color);}
}

@keyframes lower {
    from {transform: translateY(-100%);}
    to {transform: translateY(0);}
}

@keyframes wiggle {
    0% {transform: rotate(0deg);}
    25% {transform: rotate(5deg);}
    50% {transform: rotate(-5deg);}
    75% {transform: rotate(2deg);}
    100% {transform: rotate(0);}
}

@keyframes shake {
    0% {transform: translateX(0);}
    25% {transform: translateX(-2%);}
    50% {transform: translateX(2%);}
    75% {transform: translateX(-2%);}
    100% {transform: translateX(0);}
}

@keyframes bar-rotate {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(1deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-1deg); }
    100% { transform: rotate(0deg); }
}

@keyframes bar-shakeX {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(0); }
    75% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

@keyframes bar-shakeY {
    0% { transform: translateY(0); }
    25% { transform: translateY(2px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

@keyframes bar-shakeX-treme {
    0% { transform: translateX(0); }
    25% { transform: translateX(-20px); }
    50% { transform: translateX(0); }
    75% { transform: translateX(20px); }
    100% { transform: translateX(0); }
}

@keyframes bar-shakeY-xtreme {
    0% { transform: translateY(0); }
    25% { transform: translateY(10px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

@keyframes bar-rotate-xtreme {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-5deg); }
    100% { transform: rotate(0deg); }
}

@keyframes slide-up {
    from { bottom: -50%; visibility: hidden;}
    to { bottom: 0; visibility: visible; }
}

@keyframes slide-down {
    from { bottom: 0; visibility: visible;}
    to { bottom: -50%; visibility: hidden; }
}

* {
    padding: 0;
    margin: 0;
    font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif
}

body {
    text-align: center;
    background-color: var(--background-color);
    animation: lower 5s;
}

/* TOP BUTTONS */

.topButtons *{
    position: fixed;
    outline: none;
    border: none;
    background-color: transparent;
    width: min(8vw, 40px);
}

#help {
    animation: wiggle 2s;
    animation-delay: 4.5s;
    padding: min(6vw, 40px);
    padding-right: 0px;
    font-size: min(8vw, 40px);
    color: var(--foreground-color);
    top: 1px;
    left: 0px;
}

#help:hover {
    font-size: min(9vw, 45px);
    cursor: pointer;
}

#resize {
    padding: min(6vw, 40px);
    padding-left: 0px;
    width: min(8vw, 40px);
    top: 5px;
    left: min(18vw, 100px);
}

.lightResize {
    content: url("images/darkResize.png");
}

.darkResize {
    content: url("images/resize.png");
}

.lightTheme {
    content: url("images/dark.png");
}

.darkTheme {
    content: url("images/light.png");
}

.lightStats {
    content: url("images/darkStats.png");
}

.darkStats {
    content: url("images/stats.png");
}

.lightHome {
    content: url("images/darkHome.png");
}

.darkHome {
    content: url("images/home.png");
}

.lightOnline {
    content: url("images/darkOnline.png");
}

.darkOnline {
    content: url("images/online.png");
}

#resizeImg:hover {
    width: min(9vw, 45px);
    cursor: pointer;
}

#theme {
    padding: min(6vw, 40px);
    padding-left: 0px;
    width: min(8vw, 40px);
    top: 1px;
    right: min(4vw, 20px);
}

#themeImg:hover {
    width: min(9vw, 45px);
    transform: translateX(max(-0.5vw, -3px));
    cursor: pointer;
}

#statsImg {
    padding: min(6vw, 40px);
    padding-left: 0px;
    width: min(8vw, 40px);
    top: 4px;
    right: min(8vw, 50px);
}

#statsImg:hover {
    width: min(9vw, 45px);
    cursor: pointer;
}

#onlineImg {
    padding: min(6vw, 40px);
    padding-left: 0px;
    width: min(8vw, 40px);
    top: 4px;
    right: min(22vw, 120px);
}

#onlineImg:hover {
    width: min(9vw, 45px);
    cursor: pointer;
}

#homeImg {
    animation: wiggle 2s;
    animation-delay: 4.5s;
    padding: min(8vw, 40px);
    padding-right: 0px;
    width: min(8vw, 40px);
    top: 1px;
    left: 0px;
}

#homeImg:hover {
    width: min(9vw, 45px);
    cursor: pointer;
}

/* MODALS */

.modal {
    display: none;
    position: absolute;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0,0,0);
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    font-weight: normal;
    color: black;
    border-radius: 25px;
    background-color: var(--modal-color);
    font-size: min(3vw, 20px);
    margin: 15% auto;
    padding: 40px;
    padding-bottom: 50px;
    border: 1px solid #888;
    width: 60%;
    line-height: 200%;
}

.onlineButtons * {
    width: 40%;
    padding: 3%;
    margin: 20px;
    border-radius: 8px;
    text-align: center;
    font-size: min(4vw, 30px);
    font-weight: bold;
    color: white;
    border: none;
    background-color: rgb(72, 110, 119);
    box-shadow: 0px 6px 0px rgb(45, 66, 71);
}

.onlineButtons *:hover {
    transform: translateY(-1px);
    box-shadow: 0px 7px 0px rgb(45, 66, 71);
}

.onlineButtons *:active {
    transform: translateY(2px);
    box-shadow: 0px 4px 0px rgb(45, 66, 71);
}

#report {
    padding-top: 6%;
}

#report * {
    font-size: min(3vw, 20px);
    font-weight: normal;
    width: 50%;
    margin: 0;
    padding: 1%;
}

#search {
    margin-top: 7%;
}

#publicSearch {
    width: min(60%, 320px);
}

#codeEntry {
    transform: translateX(12px);
    text-transform: uppercase;
    width: 60%;
    font-size: min(4vw, 20px);
    padding: 10px;
    border: 1px solid #bdbdbd;
    cursor: text;
    caret-color: auto;
}

::placeholder {
    text-transform: none;
}

#codeEntry:focus {
    animation: none;
    background-color: transparent;
}

h2 {
    padding: min(3vw, 20px);
    font-size: min(3.5vw, 25px);
    font-weight: bold;
}

.close {
    color: #8d5959;
    float: right;
    font-size: 40px;
    font-weight: bold;
}

.close:hover {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.inactive {
    background-color: grey;
    box-shadow: rgb(122, 122, 122);
}

/* TITLE AND TOP TEXT */

.title {
    color: var(--foreground-color);
    text-align: center;
    font-size: min(5vw, 30px);
    padding-top: 20px;
}

.darkTitle {
    content: url("images/favicon.ico");
}

.lightTitle {
    content: url("images/alpha.png");
}

#titleImg {
    padding: min(2vw, 10px);
    height: min(20vw, 120px);
}

#titleImg:hover {
    cursor: default;
    animation: wiggle 2s infinite;
}

.display {
    color: var(--foreground-color);
    font-size: min(4vw, 25px);
    text-align: center;
    margin-top: min(3vw, 20px);
    margin-bottom: min(3vw, 20px);
}

.display.turn {
    font-size: 0;
}

.turn-display-1 {
    margin: 0;
    font-size: min(4vw, 25px);
}

.turn-display-2 {
    margin: 0;
    font-size: min(4vw, 25px);
}

.turn-display-3 {
    font-size: min(4vw, 25px);
}

.display-player {
    font-size: min(4vw, 25px);
}

/* THE BOARD */

.shuffling {
    animation: shake 500ms;
}

.container {
    container-type: inline-size;
    margin: auto;
    padding: 60px;
    padding-top: 0px;
    padding-bottom: 0px;
    display: grid;
    grid-template-columns: repeat(var(--grid-rows), 1fr);
    grid-template-rows: repeat(var(--grid-rows), 1fr);
    aspect-ratio: 1 / 1;
    max-width: 500px;
}

.tile {
    border: 1px solid var(--foreground-color);
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    color: transparent;
    cursor: pointer;
}

@container (width > 0px) {
    .tile {
        font-size: calc((100cqw / var(--grid-rows)) / 1.8);
    }
}

input {
    background-color: transparent;
    text-align: center;
    border: none;
    outline: none;
    min-width: 0px;
    min-height: 0px;
    cursor: pointer;
    caret-color: transparent;
}

input:focus {
    background-color: var(--tile-blink-color);
    animation: blink 0.5s infinite alternate;
}

.tile:hover {
    background-color: var(--tile-focus-color);
}

/* TEXT CONTROL */

.player1 {
    color: var(--player-one-color);
}

.player2 {
    color: var(--player-two-color);
}

.shuffled-tile {
    color: var(--foreground-color);
}

/* RESET BUTTON */

.controls {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin-top: 1em;
    padding-bottom: 30px;
}

.controls button {
    color: white;
    background-color: rgb(156, 68, 85);
    padding: min(2vw, 8px);
    border-radius: 8px;
    border: none;
    font-size: min(3vw, 20px);
    margin-left: 1em;
    cursor: pointer;
    box-shadow: 0px 6px 0px #691c19;
}

.controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0px 7px 0px #691c19;
}

.controls button:active {
    transform: translateY(4px);
    box-shadow: 0px 2px 0px #691c19;
}

#leave {
    display: none;
}


/* DISCONNECT NOTIFICATION */

#disconnect-notif {
    color: var(--background-color);
    font-size: min(5vw, 25px);
    font-weight: normal;
    background-color: var(--foreground-color);
    padding: 20px;
    position: fixed;
    width: 100%;
    bottom: 0;
    visibility: hidden;
}

.slide-up {
    visibility: visible;
    animation: slide-up 1s forwards;
}

.slide-down {
    animation: slide-down 3s forwards;
}


/* CONFETTI */

.confetti{
    display: block;
    margin: 0 auto;
    user-select: none;
    position: fixed;
    width: 100vw;
    z-index: -1;
 }

 /* STATS PAGE */

.statsBody {
    padding-top: min(6vw, 30px);
    color: var(--foreground-color);
    font-size: min(3vw, 15px);
}

h3 {
    font-size: min(4vw, 20px);
    padding: min(4vw, 20px);
}

#barShaker {
    animation: bar-shakeY 0.3s infinite;
}

#barRotator {
    animation: bar-rotate 0.1s infinite;
}

#barContainer {
    position: relative;
    left: max(5%, calc((100vw - 500px) / 2));
    width: min(90%, 500px);
    background-color: var(--player-two-color);
    border-radius: 8px;
}

#successBarContainer {
    animation: bar-shakeX 0.2s infinite;
    /* , bar-rotate 0.15s infinite; */
    position: relative;
    left: max(5%, calc((100vw - 500px) / 2));
    width: min(90%, 500px);
    background-color: var(--player-two-color);
    border-radius: 8px;
}

#successBarContainer:hover {
    animation: bar-shakeX-treme 0.1s infinite;
}

#playerRatioBar {
    margin-top: 10px;
    width: var(--player-one-percent);
    height: min(6vw, 30px);
    background-color: var(--player-one-color);
    text-align: center;
    line-height: 30px;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    border-right-style:outset;
    border-right-width: 5px;
    border-right-color: var(--winning-player-color);
}

.secret {
    color: transparent;
    align-self: center;
    position: absolute;
    bottom: 0;
    right: 0;
    font-size: 10px;
    width: 40px;
}

.secret:hover {
    cursor: pointer;
}