.puzzle-grid {
    list-style-type: none;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(var(--puzzle-width), 1fr);
    border: 2px solid black;
    width: 35%;
    margin: 0 auto;
    max-width: 100%;
}

.puzzle-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.puzzle-title {
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 0 auto 1rem;
    max-width: 100%;
}

.puzzle-description {
    text-align: center;
    font-size: 1.2rem;
    margin: 0 auto 1rem;
    max-width: 600px;
}

.puzzle-description a {
    color: #0066cc;
    text-decoration: underline;
}

.puzzle-description a:hover {
    color: #0052a3;
}

.puzzle-score {
    text-align: center;
    font-size: 1.2rem;
    margin: 0 auto 1rem;
    max-width: 100%;
}

.puzzle-view-status {
    text-align: center;
    font-size: 1.2rem;
    margin: 0 auto 1rem;
    max-width: 100%;
}

.puzzle-cell {
    box-sizing: border-box;
    border: 2px solid black;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    font-size: max(calc(25vw / var(--puzzle-width)), 4rem);
    line-height: 1;
    font-family: "Courier New";
    transition: background-color 0.4s ease-in-out;
}

.puzzle-cell:not(.puzzle-cell-correct):not(.puzzle-cell-incorrect):not(.puzzle-cell-hint):hover {
    background-color: #d4d4d4;
}

.puzzle-cell:not(.puzzle-cell-correct):not(.puzzle-cell-incorrect):not(.puzzle-cell-hint):active {
    background-color: #ffffff;
}


@media (max-width: 1300px) {
    .puzzle-grid {
        width: 55%;
    }
    
    .puzzle-cell {
        font-size: max(calc(50vw / var(--puzzle-width)), 2rem);
    }
}
/* Mobile responsive sizing */
@media (max-width: 868px) {
    .puzzle-grid {
        width: 75%;
    }
    
    .puzzle-cell {
        font-size: max(calc(75vw / var(--puzzle-width)) * 0.75, 1.5rem);
    }
    
    .puzzle-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .puzzle-grid {
        width: 90%;
    }
    
    .puzzle-cell {
        font-size: max(calc(75vw / var(--puzzle-width)) * 0.75, 1.5rem);
    }
}

.puzzle-cell-correct {
    background-color: rgba(0, 255, 0, 0.2);
}

.puzzle-cell-correct .puzzle-cell-symbol {
    display: inline-block;
}

.puzzle-cell-correct:hover {
    background-color: rgba(0, 255, 0, 0.3);
}

.puzzle-cell-correct:active {
    background-color: rgba(0, 255, 0, 0.2);
}

.puzzle-cell-incorrect {
    background-color: rgba(255, 0, 0, 0.2);
}

.puzzle-cell-incorrect .puzzle-cell-symbol {
    display: inline-block;
}

.puzzle-cell-incorrect:hover {
    background-color: rgba(255, 0, 0, 0.3);
}

.puzzle-cell-incorrect:active {
    background-color: rgba(255, 0, 0, 0.2);
}

.puzzle-cell-hint {
    background-color: rgba(204, 0, 255, 0.2);
}

.puzzle-cell-hint .puzzle-cell-symbol {
    display: inline-block;
}

.puzzle-cell-hint .puzzle-cell-symbol.hint-fade-in {
    animation: fade-in-text 1s ease-in-out;
}

@keyframes fade-in-text {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.puzzle-cell-hint:hover {
    background-color: rgba(204, 0, 255, 0.3);
}

.puzzle-cell-hint:active {
    background-color: rgba(204, 0, 255, 0.2);
}

.puzzle-cell-selected {
    outline: 4px solid rgba(204, 0, 255);
    outline-offset: -3.5px;
}
