* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    touch-action: none; /* Prevent scroll while dragging on mobile */
}

body {
    background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #2d3748;
    overflow: hidden; /* Prevent scrolling entirely for perfect drag-drop experience */
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.app-container {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    border-radius: 24px;
    padding: 1.5rem 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    width: 95%;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 2.8rem;
    color: #667eea;
    font-weight: 800;
}

header p {
    font-size: 1.2rem;
    color: #4a5568;
}

.baskets-area {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 1rem;
    flex: 1;
    margin-bottom: 2rem;
    border-bottom: 3px dashed #cbd5e0;
    padding-bottom: 1rem;
}

.basket {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 30%;
    transition: transform 0.2s, filter 0.2s;
}

.basket.highlight {
    transform: scale(1.05);
    filter: drop-shadow(0 0 15px rgba(102, 126, 234, 0.6));
}
.basket.wrong {
    animation: shake 0.4s;
}

.basket-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
    text-align: center;
    background: #fff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.basket-img {
    font-size: 5rem;
    position: relative;
    z-index: 10;
}

.basket-contents {
    display: flex;
    gap: -10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: -20px;
    z-index: 11;
}
.basket-item {
    font-size: 2rem;
    margin: -8px;
}

.pool-area {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.2rem;
    min-height: 120px;
}

.draggable-item {
    width: 80px;
    height: 80px;
    background: #fff;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3.5rem;
    cursor: grab;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}
.draggable-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}
.draggable-item:active {
    cursor: grabbing;
}
.draggable-item.dragging {
    opacity: 0.3;
    transform: scale(0.9);
}

/* Drag layer for floating item */
.drag-layer {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

.flying-clone {
    position: absolute;
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    box-shadow: 0 15px 30px rgba(0,0,0,0.25);
    transform: translate(-50%, -50%) scale(1.1);
    pointer-events: none; /* Let elements below receive events */
}
.flying-clone.snapping {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.4s ease; z-index: 10000;
}
.modal.show { opacity: 1; pointer-events: auto; }
.modal-content {
    background: #fff; padding: 3rem; border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2); text-align: center;
    transform: translateY(20px); transition: transform 0.4s ease;
}
.modal.show .modal-content { transform: translateY(0); }
.modal-content h2 { font-size: 2.5rem; color: #2d3748; margin-bottom: 1rem; }
.modal-content p { font-size: 1.5rem; color: #4a5568; margin-bottom: 2rem; }

#restart-btn {
    background: #667eea; color: white; border: none; padding: 1rem 2.5rem;
    font-size: 1.2rem; font-weight: 700; border-radius: 50px; cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
}
#restart-btn:hover {
    background: #5a67d8; transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

@media (max-width: 650px) {
    .app-container {
        width: 100%; height: 100vh; max-width: none; max-height: none; border-radius: 0; padding: 1.2rem; padding-top: 60px; overflow-y: hidden; border: none;
        display: flex; flex-direction: column; justify-content: space-evenly;
    }
    header h1 { font-size: 1.8rem; margin-bottom: 0.2rem; }
    #round-display { font-size: 1.2rem !important; margin-bottom: 0 !important; }
    header p { display: none; }
    .baskets-area { gap: 0.5rem; margin-bottom: 0; padding-bottom: 0.5rem; flex: 1; align-items: center; }
    .basket-title { font-size: 0.9rem; padding: 0.3rem 0.5rem; margin-bottom: 0.5rem; }
    .basket-img { font-size: 3.5rem; margin-bottom: 0.5rem; }
    .pool-area { gap: 1rem; min-height: 100px; justify-content: center; align-items: center; }
    .draggable-item { width: 55px; height: 55px; font-size: 2.2rem; border-radius: 14px; }
    .basket-item { font-size: 1.2rem; margin: -2px; }
}
