:root {
    --bg-color: #97cbff;
    --card-bg: #ffffff;
    --primary: #507e00;
    --primary-dark: #588157;
    --accent: #f00024;
    --text: #344e41;
    --radius: 12px;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; }

body {
    background-color: var(--bg-color);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.header { text-align: center; margin-bottom: 20px; }

.stats-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    background: var(--card-bg);
    padding: 10px 25px;
    border-radius: 50px;
    box-shadow: var(--shadow);
    font-weight: bold;
}

/* Puzzle Board Area */
#puzzle-wrapper {
    width: 100%;
    max-width: 500px;
    background: #e2e8f0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    aspect-ratio: 1 / 1; 
}

#puzzle-board {
    display: grid;
    width: 100%;
    height: 100%;
}

/* Individual Tiles */
.tile {
    position: relative;
    background-repeat: no-repeat;
    border: 1px solid var(--card-bg);
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s ease;
    touch-action: manipulation;
}

.tile.empty { background: #cbd5e1 !important; border: none; cursor: default; }

/* Sequence Numbers */
.tile-number {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--text);
    font-size: 1 rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    display: block; /* Toggled via JS */
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
    max-width: 600px;
}

button, .file-input-label {
    padding: 12px 18px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

button:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-accent { background: var(--accent); }
#image-upload { display: none; }

@media (max-width: 480px) {
    #puzzle-wrapper { width: 92vw; }
    button { padding: 10px 14px; font-size: 0.8rem; }

}
