:root {
  --color-bg-start: #7a2525;
  --color-bg-end: #000;
  --color-accent: #e63946;
  --color-accent-light: #ff6b6b;
  --color-text: #e9e9e9;
  --color-health: #ff0000;
  --color-health-player: #00ff00;
  --radius: 0.6rem;
  --shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  --font-main: "Playfair Display", serif;
  --transition: all 0.25s ease;
}

* {
    margin: 0px;
    padding: 0px;
    box-sizing: border-box;
}

html {
    min-height: 840px;
}

body {
    overflow: hidden;
}

body, html {
    height: 100%;
}

body {
    background: #7a2525;
    background: linear-gradient(312deg, rgba(122, 37, 37, 1) 0%, rgba(0, 0, 0, 1) 54%, rgba(0, 0, 0, 1) 100%);
    color: #e9e9e9;
    font-family: "Playfair Display";
    /* background-image: url(../images/background.jpg); */
    /* background-position: center center;
    background-repeat: no-repeat;
    background-size: cover; */
}

/* button {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transform: translateY(0px);
    transition:  0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
}

button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
} */

button:focus-visible {
    outline: none;
}

.main{
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    height: 100%;
    width: 100%;
    margin: 0 auto;
}

.btn.btn-shine {
    background: #e9e9e9;
}

.btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transform: translateY(0px);
    transition:  0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-shine {
    border: 1px solid;
    overflow: hidden;
    position: relative;
    background: transparent;
    transition: all 0.3s ease;
}

.btn-shine::after {
    background: #707070;
    content: "";
    height: 155px;
    left: -75px;
    opacity: 0.2;
    position: absolute;
    top: -50px;
    transform: rotate(35deg);
    transition: all 600ms cubic-bezier(0.19, 1, 0.22, 1);
    width: 50px;
    z-index: 10;
}

.btn-shine:hover {
    /* background: rgb(255 255 255 / 71%); */
    transform: translateY(-2px);
}

.btn-shine:hover::after {
    left: 120%;
}

.field-box {
    margin-left: 40px;
}

.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 30px;
    padding: 10px 0px;
    margin: 0px;
}

.game-rules, .game-over, .top-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    padding: 20px;
}

.game-rules.active, .game-over.active, .top-results.active {
   opacity: 1;
   visibility: visible;
}

.list-rules, .game-over-info, .top-results-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 600px;
    padding: 1.5rem;
    background: rgba(20, 20, 20, 0.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.game-rules.active .list-rules, .game-over.active .game-over-info, .top-results.active .top-results-info  {
    opacity: 1;
    transform: translateY(0);
}

/* .game-rules.closing .list-rules {
    opacity: 0;
    transform: translateY(-30px);
} */

.list-rules-title, .top-results-title {
    text-align: center;
}

.list-rules img {
    width: 20px;
}

.game-rules__close-btn {
    font-weight: 600;
    cursor: pointer;
    width: 100px;
    margin: 0 auto;
}

.game-rules__close-btn:hover {
    opacity: 0.9;
}

.game-over-btns, .top-results-btns {
    display: flex;
    gap: 10px;
    margin: 0 auto;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.field {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative; 
    width: 1208px;
    height: 728px;
    margin: 0 auto;
    border: 4px solid var(--color-text);
    border-radius: var(--radius);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.field .tile {
    position: absolute;
    width: 30px;
    height: 30px;
    background-size: 100%;
    background-image: url(../images/tile-.jpg);
    z-index: 5;
}

.field .tileW {
    background-image: url(../images/tile-W.jpg);
}

.field .tileE {
    background-image: url(../images/tile-E.jpg);
    z-index: 10;
}

.field .tileP {
    background-image: url(../images/tile-P.jpg);
    z-index: 10;
}

.field .tileHP {
    background-image: url(../images/tile-HP.jpg);
    /* background: linear-gradient(135deg, #2980b9, #3498db); */
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.6), inset 2px 2px 5px rgba(255, 255, 255, 0.4);
    border: 2px solid #4197cf;
    z-index: 9;
}

.field .tileSW {
    background-image: url(../images/tile-SW.jpg);
    /* background: linear-gradient(135deg, #f39c12, #f1c40f); */
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.6), inset 2px 2px 5px rgba(255, 255, 255, 0.3);
    border: 2px solid #ffa56a;
    z-index: 9;
}

.field .tile .health {
    background-color: #ff0000;
    z-index: 11;
    position: absolute;
    left: 0px;
    top: 0px;
    height: 4px;
    border-radius: 10px;
}

.field .tileP .health {
    background-color: #00ff00;
    z-index: 11;
    position: absolute;
    left:
    0px;
    top: 0px;
    height: 4px;
    border-radius: 10px;
}

.game-info {
    display: flex;
    gap: 20px;
    font-size: 20px;
    font-weight: 600;
    line-height: 20px;
}

.game-info p {
    position: relative;
    width: 55px;
    margin-top: 10px;
}

.game-info span {
    position: absolute;
    top: -2px;
    padding-left: 2px;
}

.game-info img {
    width: 22px;
    height: 22px;
}

.low-health {
    border: 4px solid #ff0000;
    animation: pulseHealth 1.5s ease-in-out infinite;
}

.low-health-text {
    color: #ff0000;
}

.sword {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
}

.sword-img {
    width: 100%;
    min-width: 300px;
    max-height: 900px;
}

.game-over__yes-btn, .game-over__cancel-btn,  .top-results-btns button {
    width: 100px;
}

.top-results-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 16px;
    margin: 10px 0px;
    min-height: 20px;
    max-height: 220px;
    overflow-y: auto;
    text-align: center;
    width: 280px;
    scrollbar-width: thin;
}

.top-results-table {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) rgba(20, 20, 20, 0.8);
    padding-right: 4px;
}

.top-results-table span {
    padding: 10px;
    border-radius: 8px;
}

.top-results-table span:nth-child(odd) {
  background: #3e3e3e;
}

.top-results-table span:nth-child(even) {
  background: #5b4242;
}

/***********animation***********/

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-30px);
    }
}

@keyframes pulseHealth {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(255, 0, 0, 0.3);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

/***********media***********/

@media (max-width: 1600px) {
    html {
        min-width: 1368;
        min-height: 720px;
    }

    .field {
        width: 1008px;
        height: 608px;
    }

    .field .tile .health {
        height: 3px;
    }

    .sword-img {
        max-height: 700px;
    }
}

@media (max-width: 1368px) {
    html {
        min-width: 1200px;
        min-height: 600px;
    }

    .field {
        width: 808px;
        height: 488px;
    }

    .field .tile .health {
        height: 2px;
    }

    .sword-img {
        max-height: 500px;
    }
}

@media (max-width: 1200px) {
    html {
        min-width: 820px;
        min-height: 600px;
    }

    .field-box {
        margin-left: 0px;
    }

    .sword {
        display: none;
    }
}