:root {
    --field-padding: 12px;
    --field-gap: 20px;
    --chunk-size: 46px;
    --slot-size: 176px;
}

body {
    font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
    color: rgb(119, 110, 101);
    margin: auto;
    background: #FAF8EF;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overflow-y: hidden;
    overflow-x: hidden;
}

a {
    color: #776e65;
}

/*Header*/

.heading {
    width: 600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
}

.game-container {
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

.title {
    font-size: 81px;
    font-weight: bold;
    margin: 0;
    display: block;
}

.game-area-opponent {
    position: relative;
    zoom: 0.3;
}

.scores-container {
    height: 55px;
    text-align: right;
    margin-top: 20px;
}

.score-container, .leaderboard-button {
    display: inline-block;
    background: #bbada0;
    padding: 15px 15px;
    height: 25px;
    font-weight: bold;
    border-radius: 3px;
    text-align: center;
    position: relative;
    vertical-align: bottom;

    text-transform: uppercase;
    font-size: 13px;
    line-height: 13px;
    text-align: center;
    color: #eee4da;
}

.score-container__title {
    margin: 0;
    flex-shrink: 1;
    flex-basis: auto;
    text-overflow: ellipsis;
    overflow: hidden;
}

.leaderboard-button {
    cursor: pointer;
    min-width: 80px;
    color: #fff;
}

.leaderboard-button_close{
    background: rgb(119, 110, 101);
    height: 25px;
    line-height: 47px;
    font-weight: bold;
}

.leaderboard-button__close{
    font-size: 25px;
}

.top, .score, .leaderboard-button__highlight {
    color: #fff;
    font-size: 18px;
    line-height: 18px;
}

.leaderboard-button__highlight {
    color: #eee4da;
    text-transform: uppercase;
}

.pause {
    display: inline-block;
    background: rgb(119, 110, 101);
    padding: 15px 15px;
    font-size: 25px;
    height: 25px;
    line-height: 47px;
    font-weight: bold;
    border-radius: 3px;
    color: white;
    text-align: center;
    position: relative;
    cursor: pointer;
    vertical-align: bottom;
}

.with-price {
    display: flex;
    align-items: center;
}

.fullscreen {
    text-align: center;
    padding: 10px 0;
}

.fullscreen_hidden {
    opacity: 0;
    visibility: hidden;
}

/*Playing Field*/

#left {
    width: 600px;
    position: relative;
}

.box {
    position: relative;
    width: 600px;
    margin: auto;
}

.grid-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--field-padding);
    background: #CDC1B4;
    border-radius: 3%;
}


.game-area-opponent .score-container__title {
    color: rgb(119, 110, 101);
}

.game-area-opponent .score-container {
    padding-bottom: 0;
}



.game-area-opponent .gameover-message {
    width: 100%;
    box-sizing: border-box;
    margin: auto;
}


.grid-row {
    height: var(--chunk-size);
    display: flex;
    gap: 2px;
}

.chunk {
    width: var(--chunk-size);
    height: var(--chunk-size);
    background: rgba(238, 228, 218, 0.35);
    border-radius: 20%;
    -webkit-animation-name: fadeIn;
    -webkit-animation-duration: 1s;
    animation-name: fadeIn;
    animation-duration: 1s;
}

.chunk-row {
    display: flex;
    gap: 2px;
}

.paypal-form {
	display: inline-block;
}

.clear-score {
    padding: 5px 0;
}

.leaderboard {
    width: 600px;
    margin: 0 auto;
    background: #CDC1B4;
    border-radius: 20px;
    font-size: 20px;
    padding: 1px 0;
    -webkit-animation-name: fadeIn;
    -moz-animation-name: fadeIn;
    -o-animation-name: fadeIn;
    animation-name: fadeIn;
    -webkit-animation-duration: 1s;
    -moz-animation-duration: 1s;
    -o-animation-duration: 1s;
    animation-duration: 1s;
}

.leaderboard__list {
    margin: 0;
    padding: 0 9px;
    border-collapse: separate;
    border-spacing: 0 9px;
    font-size: inherit;
}

.leaderboard__item {
    background: rgba(238, 228, 218, 0.35);
}

.leaderboard__item_1 {
    background: gold;
}

.leaderboard__item_2 {
    background: ghostwhite;
}

.leaderboard__item_3 {
    background: orange;
}

.leaderboard__item_user {
    background: #eeecfe;
}

.leaderboard__rank {
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
    padding: 5px 10px 5px 15px;
}

.leaderboard__avatar {
    width: 36px;
    border-radius: 18px;
}

.leaderboard__name {
    padding: 5px 10px;
    width: 100%;
}

.leaderboard__number-wrap {
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
    padding: 5px;
}

.leaderboard__number {
    display: inline-block;
    background: rgb(119, 110, 101);
    color: #fff;
    border-radius: 20px;
    min-width: 140px;
    text-align: center;
    padding: 5px;
}

.gameover-message {
    background-color: rgba(230,217,204,0.8);
    padding: 40px 0;
    margin: 0;
}

.gameover-message__rank {
    margin: 20px 0 0;
    border-radius: 5px;
}

.gameover-message__highlight {
    font-weight: bold;
    margin-left: 10px;
}

/* Overlays */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@-webkit-keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@-o-keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@-moz-keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.overlay {
    width: 600px;
    height: 600px;
    position: absolute;
    background-color: rgba(230, 217, 204, 0.71);
    border-radius: 3%;
    text-align: center;
    top: 0;
    z-index: 1;
    -webkit-animation-name: fadeIn;
    -moz-animation-name: fadeIn;
    -o-animation-name: fadeIn;
    animation-name: fadeIn;
    -webkit-animation-duration: 1s;
    -moz-animation-duration: 1s;
    -o-animation-duration: 1s;
    animation-duration: 1s;
    display: flex;
    flex-direction: column;
}

.overlay > .button + .button {
    margin-top: 10px;
}

.game-over, .wait-opponents p {
    font-size: 40px;
    font-weight: bold;
    margin: 0;
}

.wait-opponents p {
    margin: 50px 0;
}

.game-over {
    border-radius: 3%;
}

.game-over .gameover-message {
    padding: 0;
}

.game-area .game-over.overlay {
    z-index: 2;
}

.high-score p {
    font-size: 60px;
    font-weight: bold;
    height: 60px;
    line-height: 60px;
    margin-top: 160px;
    -webkit-animation: anti-text 2s;
    -moz-animation: anti-text 2s;
    -o-animation: anti-text 2s;
    animation: anti-text 2s;
    -webkit-animation-iteration-count: infinite;
    -moz-animation-iteration-count: infinite;
    -o-animation-iteration-count: infinite;
    animation-iteration-count: infinite;
}

.high-score span {
    font-size: 30px;
}

.button {
    background: rgb(119, 110, 101);
    font-size: 20px;
    border-radius: 5px;
    padding: 8px 20px;
    text-decoration: none;
    color: #f9f6f2;
    cursor: pointer;
    border: 0;
    display: table;
    margin: auto;
}

.rules-button {
    display: none;
}

.paused .keep-playing {
    margin-top: 75px;
}
.paused .reset-topscore {
    display: inline-block;
    background: rgb(119, 110, 101);
    border-radius: 3px;
    padding: 0 10px;
    text-decoration: none;
    color: #f9f6f2;
    height: 30px;
    line-height: 30px;
    cursor: pointer;
}
.tutorial h1 {
    margin-top: 150px;
}

/*Pieces spawn area*/

.pieces-container {
    width: 100%;
    height: 100%;
    margin: auto;
    background: #CDC1B4;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    box-sizing: border-box;
    gap: var(--field-padding);
    padding: var(--field-padding);
}

.slot {
    border-radius: 10%;
    background: rgba(238, 228, 218, 0.35);
    height: var(--slot-size);
    width: var(--slot-size);
}

.drag-container {
    height: 100%;
    width: 100%;
}

/*Piece generics*/

.placeholder {
    background: inherit !important;
}

.anti-chunk {
    /*Keyframes for anti animation are generated on the fly based on colors of pieces*/
    -webkit-animation: anti 2s;
    -moz-animation: anti 2s;
    -o-animation: anti 2s;
    animation: anti 2s;
    -webkit-animation-iteration-count: infinite;
    -moz-animation-iteration-count: infinite;
    -o-animation-iteration-count: infinite;
    animation-iteration-count: infinite;
}

.piece {
    margin: auto;
    position: relative;
    top: 50%;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/*Flashing figures*/

.flashing-figure {
    width: 600px;
    margin: 0 auto;
    display: none;
}

.flashing-figure p {
    text-align: center;
    margin-bottom: 0;
}

/*Big Screens Horizontal*/

@media screen and (min-width: 1040px) and (min-height: 760px) and (orientation: landscape) {
    .heading {
        width: 820px;
    }

    .leaderboard {
        width: 820px;
        margin: 20px auto;
    }

    .game-container {
        width: 820px;
        margin: var(--field-gap) auto;
    }

    #left {
        width: 600px;
    }

    .box {
        position: relative;
        width: 600px;
        margin: auto;
    }

    .pieces-container {
        width: 200px;
        height: 100%;
        margin: auto;
    }

    .below-game {
        width: 820px;
        margin: auto;
        padding: 20px 0 100px;
    }

    .flashing-figure {
        width: 820px;
    }
}

.main {
    display: flex;
    align-content: center;
    justify-content: center;
    flex-wrap: wrap;
}

.opponent-slots {
    margin-top: 7.5px;
    margin-left: 36px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

.opponent-slot {
    max-width: var(--slot-size);
}



.game-area-opponent .score-container {
    font-size: 36px;
    line-height: 1;
    height: auto;
    margin-top: 0;
    padding: 10px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: transparent;
}

.opponent-avatar {
    width: 80px;
    height: 80px;
    border-radius: 40px;
}

.opponent-slots .game-area-opponent .overlay {
    bottom: 0;
    top: auto;
}

/*Small Screens Vertical*/

@media screen and (max-width: 1039px) and (orientation: portrait) {
    .main {
        display: block;
    }

    .opponent-slots {
        display: flex;
        margin: 0;
        gap: 4px;
        flex-direction: row;
        justify-content: space-between;
    }

    .game-container {
        flex-direction: column;
    }
}

@media screen and (max-width: 615px) and (orientation: portrait) {
    :root {
        --field-padding: 6px;
        --chunk-size: 23px;
        --slot-size: 90px;
    }

    .game-container {
        flex-direction: column;
    }

    body {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    body.multiplayer {
        align-items: flex-start;
    }

    .rules-button {
        display: table;
    }

    .rules-direction {
        display: none;
    }

    .heading {
        width: 300px;
        padding: 4px 0 3px;
    }

    .title {
        display: none;
    }

    .scores-container {
        height: auto;
        text-align: right;
        margin-top: 0;
        display: flex;
        flex-grow: 1;
    }

    .score-container, .leaderboard-button {
        padding: 5px 10px;
        font-size: 10px;
        line-height: 13px;
    }

    .scores-container > * {
        flex-grow: 1;
        margin-right: 5px;
    }

    .scores-container > *:last-child {
        margin-right: 0;
    }

    .top, .score, .leaderboard-button__highlight {
        font-size: 14px;
        line-height: 14px;
    }

    .leaderboard {
        width: 300px;
        font-size: 12px;
        border-radius: 9px;
        margin: 0 auto;
    }

    .leaderboard__number {
        min-width: 70px;
    }

    .leaderboard__item {
        border-radius: 9px;
    }

    .pause {
        display: inline-block;
        background: rgb(119, 110, 101);
        font-size: 15px;
        line-height: 15px;
        padding: 10px 10px;
        height: 15px;
        border-radius: 3px;
        color: white;
        font-weight: bold;
        text-align: center;
        cursor: pointer;
        vertical-align: bottom;
    }

    #left {
        width: 300px;
    }

    .overlay {
        width: 300px;
        height: 410px;
        position: absolute;
        background-color: rgba(205, 193, 180, 0.6);
        border-radius: 3%;
        text-align: center;
        margin: auto;
        transition: opacity 1s;
        -webkit-transition: opacity 1s;
    }

    .button {
        font-size: 16px;
        padding: 7px 20px;
    }

    .game-over p {
        font-size: 30px;
        font-weight: bold;
    }

    .gameover-message {
        margin: 0;
        padding: 5px;
    }

    .high-score p {
        font-size: 30px;
        font-weight: bold;
        height: 30px;
        line-height: 30px;
        margin-top: 80px;
    }

    .high-score span {
        font-size: 15px;
    }

    .paused .keep-playing {
        margin-top: 15px;
    }

    .tutorial h1 {
        margin-top: 30px;
    }

    .box {
        position: relative;
        width: 300px;
        /* desired width */
        margin: auto;
    }

    .below-game {
        width: 300px;
        margin: auto;
        padding: 10px 0 50px;
    }

    .below-game p {
        font-size: 15px;
        line-height: 22.5px;
    }

    .flashing-figure {
        width: 300px;
    }

    .flashing-figure p {
        font-size: 14px;
        margin: 0;
    }



    .opponent-slots .opponent-slot {
        display: flex;
    }

    .opponent-slots .game-area-opponent {
        width: 350px;
    }

    .opponent-slots .game-area-opponent .game-container {
        width: 350px;
    }

    .opponent-slots .game-area-opponent .heading {
        width: auto;
        margin: 0 25px;
    }

    .opponent-slots .game-area-opponent .overlay {
        width: 100%;
        height: 320px;
    }

    .opponent-slots .game-area-opponent .gameover-message {
        margin: 0;
        padding: 10px;
    }


    .game-area-opponent .score-container {
        display: flex;
        font-size: 32px;
        line-height: 1;
    }
}

/* Medium Screens Horizontal*/

@media screen and (min-width: 616px) {
    .pieces-container {
        height: 100%;
    }
}

@media screen and (min-width: 616px) and (max-height: 759px),
    screen and (min-width: 616px) and (max-width: 1039px) and (min-height: 615px) and (max-height: 1300px) {
    :root {
        --field-padding: 12px;
        --chunk-size: 34.5px;
        --slot-size: 134px;
    }

    body {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .heading {
        width: 615px;
    }

    .rules-button {
        display: table;
    }

    .rules-direction {
        display: none;
    }

    .title {
        font-size: 41px;
        font-weight: bold;
        margin: 0;
        display: block;
    }

    .scores-container {
        height: 50px;
        text-align: right;
        margin-top: 7.5px;
    }
    .score-container, .leaderboard-button {
        padding: 5px 10px;
        font-size: 13px;
        line-height: 13px;
    }
    .top, .score, .leaderboard-button__highlight {
        font-size: 14px;
        line-height: 14px;
    }
    .leaderboard {
        width: 410px;
        font-size: 14px;
        margin: 20px auto;
    }
    .leaderboard__number{
        min-width: 100px;
    }
    .pause {
        display: inline-block;
        background: rgb(119, 110, 101);
        font-size: 15px;
        line-height: 15px;
        padding: 10px 10px;
        height: 15px;
        border-radius: 3px;
        color: white;
        font-weight: bold;
        text-align: center;
        cursor: pointer;
        vertical-align: bottom;
    }
    .game-container {
        width: 615px;
        margin: 20px auto;
        flex-direction: row;
    }
    #left {
        width: 450px;
    }
    .overlay {
        width: 100%;
        height: 100%;
        position: absolute;
        background-color: rgba(205, 193, 180, 0.6);
        border-radius: 3%;
        text-align: center;
        transition: opacity 1s;
        -webkit-transition: opacity 1s;
    }
    .button {
        font-size: 16px;
        padding: 7px 20px;
    }
    .game-over p {
        font-size: 40px;
    }
    .gameover-message {
        margin: 0;
        padding: 20px;
    }
    .high-score p {
        font-size: 30px;
        font-weight: bold;
        height: 30px;
        line-height: 30px;
        margin-top: 80px;
    }
    .high-score span {
        font-size: 15px;
    }
    .paused .keep-playing {
        margin-top: 15px;
    }
    .tutorial h1 {
        margin-top: 30px;
    }
    .box {
        position: relative;
        width: 450px;
        /* desired width */
        margin: auto;
    }

    .pieces-container {
        margin: auto;
    }

    .below-game {
        width: 410px;
        margin: auto;
        padding: 10px 0 50px;
    }
    .below-game p {
        font-size: 15px;
        line-height: 22.5px;
    }
    .flashing-figure {
        width: 410px;
    }

    .opponent-slots .game-area-opponent .overlay {
        height: 450px;
    }
}


@media screen and (max-width: 615px) and (min-height: 616px) and (orientation: portrait) {
    .pieces-container {
        margin: auto;
        flex-direction: row;
    }
}

/*Small Screens Horizontal*/

@media screen and (max-width: 419px) and (orientation: portrait) {
    .pieces-container {
        margin: auto;
        flex-direction: row;
    }
}

@media screen and (max-height: 615px) and (min-width: 420px),
        screen and (max-height: 900px) and (max-width: 615px) and (orientation: landscape) {
    :root {
        --field-padding: 6px;
        --chunk-size: 23px;
        --slot-size: 90px;
    }

    body {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .heading {
        width: 410px;
        height: 50px;
    }

    .rules-button {
        display: table;
    }

    .rules-direction {
        display: none;
    }

    .title {
        font-size: 41px;
        font-weight: bold;
        margin: 0;
        display: block;
    }
    .scores-container {
        height: 50px;
        text-align: right;
        margin-top: 7.5px;
    }
    .score-container, .leaderboard-button {
        padding: 5px 10px;
        font-size: 13px;
        line-height: 13px;
    }
    .top, .score, .leaderboard-button__highlight {
        font-size: 14px;
        line-height: 14px;
    }
    .leaderboard {
        width: 410px;
        font-size: 14px;
        margin: 20px auto;
    }
    .leaderboard__number{
        min-width: 100px;
    }
    .pause {
        display: inline-block;
        background: rgb(119, 110, 101);
        font-size: 15px;
        line-height: 15px;
        padding: 10px 10px;
        height: 15px;
        border-radius: 3px;
        color: white;
        font-weight: bold;
        text-align: center;
        cursor: pointer;
        vertical-align: bottom;
    }
    .game-container {
        width: 410px;
        margin: 20px auto;
        flex-direction: row;
    }
    #left {
        width: 300px;
    }

    .overlay {
        width: 300px;
        height: 300px;
        position: absolute;
        background-color: rgba(205, 193, 180, 0.6);
        border-radius: 3%;
        text-align: center;
        transition: opacity 1s;
        -webkit-transition: opacity 1s;
    }
    .button {
        font-size: 16px;
        padding: 7px 20px;
    }
    .game-over p {
        font-size: 30px;
        font-weight: bold;
    }
    .gameover-message {
        margin: 15px 0 10px;
        padding: 5px;
    }
    .high-score p {
        font-size: 30px;
        font-weight: bold;
        height: 30px;
        line-height: 30px;
        margin-top: 80px;
    }
    .high-score span {
        font-size: 15px;
    }
    .paused .keep-playing {
        margin-top: 15px;
    }
    .tutorial h1 {
        margin-top: 30px;
    }
    .box {
        position: relative;
        width: 300px;
        /* desired width */
        margin: auto;
    }

    .below-game {
        width: 410px;
        margin: auto;
        padding: 10px 0 50px;
    }
    .below-game p {
        font-size: 15px;
        line-height: 22.5px;
    }
    .flashing-figure {
        width: 410px;
    }

    .game-area-opponent {
        width: 300px;
    }
}

@media screen and (min-height: 820px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

@media screen and (min-width: 1039px) and (max-width: 1263px) {
    .game-area .heading {
        margin-bottom: 20px;
        text-align: center;
    }

    .game-area .title, .game-area .scores-container {
        text-align: center;
    }
}

@media screen and (orientation: portrait) and (max-height: 614px) {
    body {
        overflow-y: scroll;
    }
}

body .hidden {
    display: none;
}

.opponent-slot {
    position: relative;
    flex-grow: 1;
}

.game-area-opponent .scores-container {
    height: fit-content;
    margin: 0;
}

.game-area-opponent .score {
    font-size: 40px;
    line-height: 40px;
    margin-right: 12px;
    margin-left: auto;
    color: rgb(119, 110, 101);
}

.game-area-opponent .title {
    margin-top: 20px;
    font-size: 70px;
    line-height: 76px;
}

.game-area-opponent .heading {
    width: 100%;
    margin-bottom: 10px;
    text-align: center;
}

.game-area-opponent .game-container {
    width: 100%;
    height: fit-content;
    margin: 0 auto;
    flex-direction: column;
}

.full-screen-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    align-content: center;
    justify-content: center;
    flex-wrap: wrap;
}

.game-mode.hidden {
    display: none;
}

.full-screen-overlay__title {
    font-size: 2em;
}
