:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --dark-color: #2C3E50;
    --light-color: #F7F9F9;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --font-family: 'Fredoka', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--light-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--dark-color);
    overflow: hidden; /* Prevent scroll on drag */
}

.game-container {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 600px;
    text-align: center;
    position: relative;
    z-index: 10;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 10px;
}

.stat-box {
    display: flex;
    flex-direction: column;
}

.label {
    font-size: 0.8rem;
    color: #7f8c8d;
    text-transform: uppercase;
    font-weight: bold;
}

#score, #timer, #combo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--dark-color);
}

#category-display {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.word-drop-zone {
    display: flex;
    justify-content: center;
    gap: 10px;
    min-height: 80px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    padding: 10px;
    background: #fafafa;
    border-radius: 10px;
    border: 2px dashed #eee;
}

.tile {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: white;
    font-size: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    box-shadow: 0 4px 0 #c0392b;
    cursor: grab;
    user-select: none;
    transition: transform 0.1s, box-shadow 0.1s;
    touch-action: none; /* Important for touch events */
}

.tile:active {
    cursor: grabbing;
    transform: translateY(4px);
    box-shadow: 0 0 0 #c0392b;
}

.tile.dragging {
    opacity: 0.5;
    position: absolute;
    z-index: 100;
    pointer-events: none; /* Let events pass through to drop targets */
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 2rem;
}

.btn {
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:active {
    transform: scale(0.95);
}

.btn.primary {
    background: var(--secondary-color);
    color: white;
}

.btn.secondary {
    background: #ecf0f1;
    color: var(--dark-color);
}

.btn.special {
    background: var(--accent-color);
    color: var(--dark-color);
    width: 100%;
    margin-top: 10px;
}

footer {
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.difficulty-selector {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 10px;
}

.diff-btn {
    background: transparent;
    border: 1px solid #ddd;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
}

.diff-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Modal */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hidden {
    display: none !important;
}

/* Canvas */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* Animations */
@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

/* Responsive */
@media (max-width: 480px) {
    .tile {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }

    header h1 {
        font-size: 2rem;
    }
}
