* {
    margin: 0;
    padding: 0;
    -webkit-touch-callout: none; /* Отключает контекстное меню */
    user-select: none; /* Отключает выделение текста */
    -moz-user-select: none;
    -khtml-user-select: none;
    touch-action: none; /* Отключает все жесты, включая зум */
    -ms-touch-action: none; /* Отключает жесты на IE */
    /* Убираем лонгтап на iOS */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

:root {
    --progress: 100;
}

body {
    display: flex;
    font-family: Arial, sans-serif;
    background-image: url("static/background.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    padding: 0;
    font-size: 18px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    height: 100dvh;
    width: 100dvw;
    -webkit-touch-callout:none;
    -webkit-user-select:none;
    -khtml-user-select:none;
    -moz-user-select:none;
    -ms-user-select:none;
    user-select:none;outline:0;
}

#p_prldr {
    position: fixed;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(14, 127, 220, .7);
    background-image: url("static/background.png");
    background-position: center center;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 501;
    opacity: 1;
}

#p_prldr svg {
    /* position: fixed; */
    left: calc(50% - 50px);
    top: calc(50% - 50px);
    animation: prl-rotate .5s linear infinite;
    width: 100px;
    height: 100px;
}

#prl-progress-container {
    width: 300px;
    height: 30px;
    border: 2px solid #fff;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 20px;
}

#prl-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(rgb(217, 134, 241), rgb(197, 94, 234));
    transition: width 0.2s ease;
}

#prl-progress-text {
    margin-top: 10px;
}

@keyframes prl-rotate {
    50% {
        transform: rotate(180deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }

    50% {
        opacity: .5;
    }

    100% {
        opacity: 0;
    }
}

.fadeout {
    -webkit-animation: fadeOut 200ms ease;
    animation: fadeOut 200ms ease;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
}


#warning {
    position: absolute;
    display: none;
    width: 100dvw;
    height: 100dvh;
    background-image: url('static/pausebackground.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    z-index: 1800;
    justify-content: center;
    align-items: center;
}

@media (orientation: portrait) {
    #warning {
        display: flex;
    }

    .mainContent {
        display: none;
    }
}

.startMenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: center;
    margin: 0;
    padding: 0;
    font-size: inherit;
    background-image: url("static/background.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    z-index: 500;
}

.gameName {
    height: 20dvh;
}

.notification{
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    margin-top: -5dvh;
    padding: 20px;
    border-radius: 10px;
}
.text {
    padding: .5rem;
    font-size: 3dvh;
    font: bold;
    box-shadow: 0 4px 15px rgba(189, 147, 249, 0.3);
    color: white;
}
.buttonMenu {
    background: linear-gradient(90deg, #FF79C6 0%, #BD93F9 100%);
    border: none;
    border-radius: 12dvh;
    color: white;
    padding: 1rem 2rem;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(189, 147, 249, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.buttonMenu:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(189, 147, 249, 0.4);
}

.buttonStart:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(189, 147, 249, 0.3);
}

.buttonMainMenu {
    /* margin-top: 60dvh; */
    display: block;
    margin-left: auto;
    margin-right: auto;
    font-size: 3dvh;
}

#howToPlayPic {
    width: calc(min(70dvw, 80dvh));
    height: auto;
}

.blur {
    display: none;
    position: fixed;
    z-index: 750;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.heartPic {
    height: 8dvh;
    aspect-ratio: 1;
}

.topbarPic {
    height: 8dvh;
    aspect-ratio: 1;
    vertical-align: middle;
    cursor: pointer;
}

.game-container {
    margin-top: 0.5dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    height: 100dvh;
    width: 100dvw;
}

.top-bar {
    height: 10dvh;
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin: 10px 0 0 0;
    width: 80%;
    gap: 20px;
    background-color: rgb(0/0, 0/0, 0/0);
}

.level {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0);
    font-size: calc(10px + 1.2vw);
    height: 100%;
}

.level img {
    height: 60%;
}

.levelNum {
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url(static/levelCircle.png);
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    width: 4rem;
    height: 4rem;
    font-size: 1.5em;
    padding-bottom: 0.2rem;
    padding-right: 0.4rem;
    text-shadow: 2px 2px 2px rgba(226, 14, 216, 0.788);
    color: white;
}

.progressDiv {
    display: flex;
    flex: 1 1 35%;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0);
    height: 100%;
}

.progressDiv img {
    height: 70%;
    aspect-ratio: 1;
    position: relative;
    left: 20px;
    top: -2px;
    aspect-ratio: 1/1.1;
}

.progressNum {
    display: none;
}


.progress-bar {
    width: 100%;
    height: 40%;
    background: rgba(5, 185, 165);
    border: rgba(36, 217, 205) 5px solid;
    border-radius: 13px;
    overflow: hidden;
}


.progress {
    height: 100%;
    width: calc(var(--progress) * 1%);
    background-image: linear-gradient(rgb(217, 134, 241), rgb(197, 94, 234));
    border-radius: 10px;
    z-index: 10;
}

.progress-circle {
    display: none;
}

.hearts {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    z-index: 1;
}

.heart {
    display: flex;
    height: 100%;
    align-items: center;
}

.heartsFull {
    background-image: url("static/heartsFull.png");
    background-size: cover;
    z-index: 2;
    max-width: 100%;
    aspect-ratio: 1;
}

.heartsBroken {
    background-image: url("static/heartsBroken.png");
    background-size: cover;
    z-index: 2;
    max-width: 100%;
    aspect-ratio: 1;
}

.controls {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0);
}

.controls button {
    width: 4em;
    height: 4em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
}

.controls button img {
    width: 80%;
    height: 80%;
}

.helpcount {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: #e590ff;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
}

#advIco {
    position: absolute;
    bottom: 0;
    left: 0;
    background-image: url("static/adv_ico.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 20px;
    height: 20px;
    display: none;
}

.zoom {
    position: relative;
}

.game-area {
    margin: auto;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* width: fit-content; */
}

#game-board {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    padding: 10px;
    /* flex-wrap: wrap; */
    gap: 1px;
    margin: auto;
    margin-top: -2rem;
    z-index: 3;
}

.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 20px;
    z-index: 0;
}


.bottom-bar img {
    max-height: 5dvh;
    aspect-ratio: 1;
    margin-left: 2dvw;
    margin-right: 2dvw;
}

.bottom-bar img {
    cursor: pointer;
}

.tile {
    width: calc(min(65dvw/16, 130dvh/16));
    height: calc(min(65dvw/16, 130dvh/16));
    /* display: flex; */
    justify-content: center;
    align-items: center;
    font-size: 8px;
    cursor: pointer;
    border-radius: 10px;
    user-select: none;
    transition: background-color 0.3s;
}

@keyframes tileSelected {
    0% {
        transform: scale(1.1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes nainSelected {
    0% {
        transform: rotate(10deg);
    }

    50% {
        transform: rotate(-10deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

@keyframes tileMatched {
    0% {
        transform: scale(1);
        visibility: visible;
        opacity: 1;
    }

    50% {
        transform: scale(0.5);
    }

    100% {
        transform: scale(0);
    }
}

@keyframes inReshaffle {
    0% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(180deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.reshuffle td {
    animation: inReshaffle 0.7s linear;
}

.tile.selected {
    background-color: #f0ff22;
    animation: tileSelected 0.7s linear infinite;
}

.tile.unpair {
    background-color: #ff2222;
    animation: nainSelected 0.7s linear infinite;
}

.tile.availableTile {
    background-color: #22ff77;

}

.tile.matched {
    visibility: hidden;
    opacity: 0;
    animation: tileMatched 0.5s linear;
}

h1,
h2 {
    color: white;
    font-family: Arial, sans-serif;
    margin: 10px 0;
}

.pause_screen {
    display: none;
    width: 100%;
    position: relative;
    background-color: rgba(0, 0, 0, 0);
    z-index: 800;
    justify-content: center;
    align-items: center;
}

.pause_screen button {
    width: 20vw;
    height: 20vh;
    background-color: rgba(0, 0, 0, 0);
    background-image: url('static/unpause2.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    z-index: 800;
    cursor: pointer;
    border: none;
}


.border-tile {
    content: " ";
}

@media (max-width: 915px) {
    .game-container {
        flex-direction: row;
        gap: 0;
        padding-top: 20px;
    }

    .game-area {
        transform: scale(1.1);
    }

    .top-bar {
        flex-direction: column;
        align-self: start;
        justify-content: center;
        align-items: center;
        width: auto;
        height: auto;
        gap: .5dvh;
        margin-left: 30px;
    }

    .level img {
        display: none;
    }

    .hearts {
        flex-direction: column;
    }

    .controls {
        flex-direction: column;
    }

    .progressDiv img {
        display: none;
        width: 10%;
        border-radius: 50%;
        position: relative;
        left: 10px;
        top: 10px;
    }

    .progress-bar {
        display: none;
    }

    .modal-container {
        padding: 0px;
    }

    #timeUpModal {
        transform: scale(0.8);
        padding: 0;
    }

    .levelNum {
        width: 2rem;
        height: 2rem;
        font-size: 1.2em;
        padding-bottom: 0.1rem;
        padding-right: 0.2rem;
    }

    .bottom-bar {
        position: unset;
        padding: 0;
        padding-top: 10px;
        padding-bottom: 20px;
        padding-right: 20px;
        flex-direction: column;
        justify-content: space-between;
        align-items: stretch;
        height: 80%;
    }

    .bottom-bar img {
        max-height: 3dvw;
        aspect-ratio: 1;
        margin-left: -1dvw;
        justify-self: center;
    }

    .progress-circle {
        width: 4dvw;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    #progressCircle {
        stroke-dashoffset: calc(var(--progress));
        stroke: linear-gradient(to right, rgb(255, 0, 234), #aef);
        box-shadow: 10px 10px 10px 10px #000000;
    }
}

@media (min-width: 2000px) {

    .game-area {
        margin-top: -15dvh;
        transform: scale(0.6);
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

.modal-container {
    background-color: #e590ff;
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    width: 400px;
    margin: 50px auto;
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 5px;
    width: 300px;
    text-align: center;
}

.modal-content button {
    padding: 10px 20px;
    margin-top: 10px;
    cursor: pointer;
}

.modal-hearts {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes drawArrow {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes fill {
    to {
        stroke-dashoffset: 0;
    }
}

@-webkit-keyframes fill {
    to {
        stroke-dashoffset: 0;
    }
}