:root {
    --bg-cream: #fbf9f5;
    --text-main: #7a8b8b;
    --border-color: #e5ded8;
}

body {
    margin: 0;
    padding: 15px;
    background-color: var(--bg-cream);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
    background-image: radial-gradient(#e8dfd8 0.75px, transparent 0.75px);
    background-size: 16px 16px;
}

h1 {
    font-size: 1.3rem;
    margin: 5px 0;
    text-align: center;
    letter-spacing: 1px;
    display: flex;
    gap: 8px;
    font-weight: bold;
}

h1 .c-pink { color: #e8a5a2; }
h1 .c-blue { color: #8ecae6; }
h1 .c-green { color: #95d5b2; }

p.subtitle {
    font-size: 0.8rem;
    color: #999;
    margin: 0 0 6px 0;
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    padding: 4px 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

p.progress {
    font-size: 0.85rem;
    font-weight: bold;
    color: #d63384;
    margin: 0 0 10px 0;
}

.stage-wrapper {
    width: 100%;
    max-width: 340px;
    overflow: visible;
}

/* المسرح: منطقة كبيرة تحتوي الإطار + القطع المتناثرة حوله */
.stage {
    position: relative;
    width: 320px;
    height: 620px;
    margin: 0 auto;
    touch-action: none;
}

/* الإطار: يبين وين تتجمع القطع */
.frame {
    position: absolute;
    left: 0;
    top: 0;
    width: 320px;
    height: 320px;
    background-color: #f0ebe4;
    border: 3px dashed #cbb9a8;
    border-radius: 16px;
    box-sizing: border-box;
    overflow: hidden;
}

/* طبقة الصورة المرجعية: ضبابية وخافتة، بس تعطي فكرة عن أماكن القطع */
.frame::before {
    content: '';
    position: absolute;
    inset: -12px;
    background-image: url('baby.jpeg');
    background-size: cover;
    background-position: center;
    filter: blur(3px);
    opacity: 0.55;
}

.puzzle-piece {
    cursor: grab;
    touch-action: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.28));
}

.puzzle-piece.lifted {
    cursor: grabbing;
    filter: drop-shadow(0 8px 14px rgba(0,0,0,0.35));
    transform: scale(1.04);
}

.puzzle-piece.placed {
    cursor: default;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 340px;
    margin-top: 14px;
}

button {
    width: 100%;
    border: none;
    padding: 10px 0;
    font-size: 0.85rem;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.btn-reset {
    background: linear-gradient(135deg, #e8a5a2, #f2c6c2);
    color: #665c5c;
    box-shadow: 0 4px 12px rgba(232, 165, 162, 0.3);
}

button:active {
    transform: scale(0.97);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    width: 80%;
    max-width: 280px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    border: 2px solid var(--border-color);
}

.modal-content h2 {
    color: #d63384;
    font-size: 1.8rem;
    margin: 10px 0;
}
