html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #222;
    min-width: 100%;
}

h1 {
    margin-bottom: 10px;
    color: #fff;
    font-size: 1.6em;
}

.info-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 450px;
    margin-bottom: 10px;
    font-size: 1.2em;
    color: #fff;
    min-width: 450px;
}

.info-panel-top-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 10px;
}

.difficulty-buttons button,
#restart-btn {
    padding: 3px 8px;
    font-size: 0.9em;
    cursor: pointer;
    margin: 0 5px;
}

button {
    background-color: rgb(177, 177, 177);
}

.difficulty-buttons button.active-difficulty {
    text-decoration: underline;
}

.score-counter span {
    margin: 0 6px;
    display: inline-block;
}

.score-counter {
    padding: 5px 10px;
    background-color: #0000002a;
    margin-top: 5px;
    width: 100%;
    text-align: center;
}

canvas {
    background-color: #c0c0c0;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    transform-origin: top;
    max-width: 100vw;
}

.win-glow {
    box-shadow: 0 0 40px rgba(0, 255, 0, 0.8);
}

.lose-glow {
    box-shadow: 0 0 40px rgba(255, 0, 0, 0.8);
}

.score-animation {
    animation: score-pulse 1s;
}

@keyframes score-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    position: relative;
}

.controls-container {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    width: 100%;
}

.arrow-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.controls button {
    width: 60px;
    height: 60px;
    font-size: 1.2em;
    cursor: pointer;
    background-color: rgb(177, 177, 177);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.arrow-btn .v-shape {
    font-size: 2em;
    font-weight: bold;
    color: #333;
}

#up-btn .v-shape {
    transform: rotate(-180deg);
}

#left-btn .v-shape {
    transform: rotate(90deg);
}

#right-btn .v-shape {
    transform: rotate(-90deg);
}

#up-btn {
    margin-bottom: 10px;
}

.horizontal-controls {
    display: flex;
    align-items: center;
}

.horizontal-controls #left-btn {
    margin-right: 10px;
}

.horizontal-controls #right-btn {
    margin-left: 10px;
}

.flag-controls {
    margin-top: 10px;
}

#flag-btn {
    width: 40px;
    height: 40px;
    font-size: 1.5em;
    position: absolute;
    top: 0;
    left: 0;
}

#flag-grid {
    display: grid;
    grid-template-columns: repeat(3, 43.333px);
    grid-template-rows: repeat(3, 43.333px);
    gap: 0px;
    margin: 0px;
    margin-left: 10px;
}

.flag-grid-btn {
    width: 43.333px !important;
    height: 43.333px !important;
    background-color: rgb(177, 177, 177);
    margin: 0;
    padding: 0;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flag-grid-btn .v-shape {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
}

.flag-grid-btn[data-r="-1"][data-c="-1"] .v-shape {
    transform: rotate(135deg);
}

.flag-grid-btn[data-r="-1"][data-c="0"] .v-shape {
    transform: rotate(180deg);
}

.flag-grid-btn[data-r="-1"][data-c="1"] .v-shape {
    transform: rotate(225deg);
}

.flag-grid-btn[data-r="0"][data-c="-1"] .v-shape {
    transform: rotate(90deg);
}

.flag-grid-btn[data-r="0"][data-c="1"] .v-shape {
    transform: rotate(-90deg);
}

.flag-grid-btn[data-r="1"][data-c="-1"] .v-shape {
    transform: rotate(45deg);
}

.flag-grid-btn[data-r="1"][data-c="0"] .v-shape {
    transform: rotate(0deg);
}

.flag-grid-btn[data-r="1"][data-c="1"] .v-shape {
    transform: rotate(-45deg);
}

.flag-grid-btn:hover {
    background-color: #a0a0a0;
}

.hidden {
    display: none !important;
}