/* Nupuderida */
.puzzle-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.game-container {
    max-width: 100%;
    margin: 0 auto;
}

#canvas-container {
    height: calc(100vh - 160px);
    height: calc(100dvh - 160px);
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    border-radius: 8px;
    background-image: 
        linear-gradient(45deg, #eee 25%, transparent 25%), 
        linear-gradient(-45deg, #eee 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #eee 75%), 
        linear-gradient(-45deg, transparent 75%, #eee 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    touch-action: none; /* Prevent scroll on mobile */
}

/* Make canvas sharp */
canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    cursor: grab;
}

canvas:active {
    cursor: grabbing;
}

.file-label {
    width: 100%;
}
.file-name {
    max-width: none;
}

/* Animations */
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#winOverlay {
    /* Animation removed from container to avoid conflict with transform centering */
}

.win-popup {
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(5px);
}

/* Mängude nimekiri */
.puzzle-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color, #dbdbdb);
    border-radius: 8px;
    background: var(--bg-card, #fff);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.puzzle-list-item:last-child {
    margin-bottom: 0;
}

.puzzle-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.puzzle-list-item.is-expired {
    opacity: 0.6;
}

.puzzle-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.puzzle-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
    flex-shrink: 0;
}

.puzzle-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

[data-theme="dark"] #canvas-container {
    background-color: #2a2a2a;
    background-image:
        linear-gradient(45deg, #333 25%, transparent 25%),
        linear-gradient(-45deg, #333 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #333 75%),
        linear-gradient(-45deg, transparent 75%, #333 75%);
}

@media screen and (max-width: 768px) {
    #canvas-container {
        height: calc(100vh - 180px);
        height: calc(100dvh - 180px);
    }

    .puzzle-toolbar .button span:not(.icon) {
        display: none;
    }

    .puzzle-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
}
