:root {
    --tile-size: 100px;
    --board-size: calc(var(--tile-size) * 4);
}

body {
    margin: 0;
    padding: 0;
    background-color: black;
    color: white;
    font-family: Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1% 2%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 30;
}

.profile-container {
    display: flex;
    align-items: center;
    text-align: center;
}

.profile-pic {
    width: 5vw;
    height: 5vw;
    max-width: 70px;
    max-height: 70px;
    border-radius: 50%;
    object-fit: cover;
}

.nav-menu {
    margin-top: 1rem;
}

.nav-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: row;
}

.nav-menu li {
    margin: 0 3rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-size: clamp(1rem, 2vw, 1.125rem);
}

.nav-menu a:hover {
    color: #ccc;
}

.profile-header {
    display: flex;
    justify-content: center;
    align-items: center;
}

.content-wrapper {
    margin-top: calc(70px + 2rem);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 1%;
    flex-grow: 1;
}

.game-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 20px;
}

.game-container {
    width: var(--board-size);
    height: var(--board-size);
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(255, 255, 255, 0.2);
    position: relative;
    user-select: none;
    overflow: hidden;
    touch-action: none;
}

.tile {
    width: var(--tile-size);
    height: var(--tile-size);
    position: absolute;
    background-size: var(--board-size) var(--board-size);
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: transform 0.25s ease;
    cursor: pointer;
    z-index: 1;
    box-sizing: border-box;
}

.tile:hover {
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.controls {
    margin: 15px 0;
}

#moves {
    font-size: 18px;
    margin: 10px 0;
    color: white;
}

#shuffleBtn, #quitBtn, #restartBtn {
    padding: 10px 20px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-right: 10px;
}

#shuffleBtn {
    background: #4CAF50;
}

#shuffleBtn:hover {
    background: #45a049;
}

#quitBtn {
    background: #f44336;
}

#quitBtn:hover {
    background: #da190b;
}

#restartBtn {
    background: #2196F3;
}

#restartBtn:hover {
    background: #1976D2;
}

#shuffleBtn:disabled, #quitBtn:disabled, #restartBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#message {
    margin-bottom: 10px;
    font-size: 36px;
    font-weight: bold;
    display: none;
}

#message.win {
    color: #4CAF50;
}

#message.lose {
    color: #f44336;
}

#puzzleImage {
    display: none;
}

#referenceImage {
    display: block;
    width: var(--tile-size);
    height: var(--tile-size);
    margin: 0 auto 10px auto;
    border: 2px solid #fff;
    border-radius: 4px;
}

#instructions {
    width: var(--board-size);
    margin: 10px auto;
    padding: 10px;
    background: #1a1a1a;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(255, 255, 255, 0.2);
    text-align: left;
    font-size: 14px;
    line-height: 1.5;
}

#instructions h3 {
    margin-top: 0;
    color: #fff;
}

#instructions ul {
    margin: 0;
    padding-left: 20px;
    color: #ccc;
}

footer {
    background-color: #1a1a1a;
    padding: 2% 0;
    text-align: center;
    margin-top: 2rem;
    width: 100%;
}

.footer-copyright {
    margin: 0;
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
    color: #aaa;
}

.social-links {
    margin-bottom: 1rem;
}

.social-links h3 {
    margin: 0 0 0.5rem 0;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: #fff;
}

.social-media-icons-wrapper {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.social-media-icons-wrapper a {
    color: #fff;
    font-size: clamp(1.5rem, 3vw, 2rem);
    text-decoration: none;
    transition: color 0.3s;
}

.social-media-icons-wrapper a:hover {
    color: #ccc;
}

@media (max-width: 768px) {
    :root {
        --tile-size: 75px;
    }
    .header-bar {
        padding: 1% 1%;
    }
    .nav-menu li {
        margin: 0 1.5rem;
    }
    .profile-pic {
        width: 8vw;
        height: 8vw;
    }
    .content-wrapper {
        margin-top: calc(60px + 1.5rem);
    }
    #instructions {
        font-size: 12px;
    }
    #moves, #shuffleBtn, #quitBtn, #restartBtn {
        font-size: 14px;
        padding: 8px 16px;
    }
    #message {
        font-size: 28px;
    }
    .social-media-icons-wrapper {
        gap: 1rem;
    }
    .social-media-icons-wrapper a {
        font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    }
}

@media (max-width: 480px) {
    :root {
        --tile-size: 65px;
    }
    .header-bar {
        padding: 1% 1%;
    }
    .profile-pic {
        width: 10vw;
        height: 10vw;
    }
    .nav-menu {
        margin-top: 0.5rem;
    }
    .nav-menu ul {
        flex-direction: row;
        align-items: center;
    }
    .nav-menu li {
        margin: 0 1rem;
    }
    .nav-menu a {
        font-size: clamp(0.875rem, 2vw, 1rem);
    }
    .content-wrapper {
        margin-top: calc(50px + 1rem);
    }
    #instructions {
        font-size: 10px;
    }
    #moves, #shuffleBtn, #quitBtn, #restartBtn {
        font-size: 12px;
        padding: 6px 12px;
    }
    #message {
        font-size: 20px;
    }
    .social-links h3 {
        font-size: clamp(0.875rem, 2vw, 1rem);
    }
    .social-media-icons-wrapper {
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    .social-media-icons-wrapper a {
        font-size: clamp(1rem, 2vw, 1.5rem);
    }
}
