/* Reset y base */
* {
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(145deg, #f9e7b3 0%, #f5c28e 100%);
    font-family: 'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive, sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.game-container {
    max-width: 1200px;
    width: 100%;
    background: #fffaf0;
    border-radius: 50px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    padding: 15px 15px 25px;
}

h1 {
    text-align: center;
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    color: #d64b2c;
    text-shadow: 3px 3px 0 #ffd966;
    margin: 0 0 5px;
    word-break: break-word;
}

.subtitle {
    text-align: center;
    font-size: clamp(0.7rem, 3vw, 1rem);
    background: #fee3b8;
    display: block;
    width: 100%;
    padding: 8px;
    border-radius: 50px;
    margin-bottom: 20px;
    font-weight: bold;
    color: #6b4c3b;
    line-height: 1.3;
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    background: #ffc491;
    border: none;
    font-size: clamp(0.9rem, 4vw, 1.2rem);
    font-weight: bold;
    padding: 10px 16px;
    border-radius: 40px;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 0 #b4622a;
    font-family: inherit;
    flex: 0 0 auto;
}

.tab-btn.active {
    background: #ff9f4a;
    color: white;
    transform: translateY(2px);
    box-shadow: 0 2px 0 #b4622a;
}

.tab-content {
    display: none;
    animation: fade 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fade {
    from { opacity: 0; transform: scale(0.98);}
    to { opacity: 1; transform: scale(1);}
}

.game-area, .associate-area {
    background: #fffaec;
    border-radius: 40px;
    padding: 15px;
    box-shadow: inset 0 0 0 2px white, 0 8px 15px rgba(0,0,0,0.1);
}

.image-card {
    background: #ffe1b3;
    border-radius: 40px;
    padding: 12px;
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.word-emoji {
    font-size: clamp(3rem, 10vw, 5rem);
    background: white;
    border-radius: 60px;
    padding: 10px 20px;
    box-shadow: 0 6px 10px rgba(0,0,0,0.1);
}

.word-hint {
    font-size: clamp(1rem, 4vw, 1.5rem);
    font-weight: bold;
    background: #fdf4dc;
    padding: 6px 15px;
    border-radius: 40px;
    color: #aa5e2b;
    text-align: center;
}

.dropzone-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0;
    padding: 12px;
    background: #eeddbb;
    border-radius: 50px;
}

.dropzone {
    background: #fff4e0;
    width: clamp(70px, 20vw, 110px);
    height: clamp(70px, 20vw, 110px);
    border-radius: 30px;
    border: 3px dashed #d49c6c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.4rem, 5vw, 2rem);
    font-weight: bold;
    transition: all 0.1s;
    text-align: center;
    word-break: break-word;
}

.dropzone.filled {
    background: #cbe5b4;
    border: 3px solid #5f8b3c;
    color: #2f4d1c;
}

.syllables-pool {
    background: #f7e5cf;
    border-radius: 50px;
    padding: 15px;
    margin-top: 15px;
}

.syllables-list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.syllable, .word-tile {
    background: #ffc576;
    font-size: clamp(1.4rem, 5vw, 2rem);
    font-weight: bold;
    width: clamp(70px, 20vw, 100px);
    height: clamp(70px, 20vw, 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 40px;
    box-shadow: 0 6px 0 #aa6d32;
    cursor: grab;
    transition: 0.05s;
    touch-action: none; /* Mejora para arrastre táctil */
}

.syllable:active, .word-tile:active {
    cursor: grabbing;
}

.syllable.hidden-syllable, .word-tile.hidden-word {
    display: none;
}

.btn {
    background: #ffad60;
    border: none;
    font-size: clamp(1rem, 4vw, 1.3rem);
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 40px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 0 #b45a2a;
    transition: 0.05s linear;
    font-family: inherit;
    margin: 5px;
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #b45a2a;
}

.message {
    text-align: center;
    font-size: clamp(1rem, 4vw, 1.3rem);
    background: #f3d382;
    margin-top: 15px;
    padding: 10px;
    border-radius: 40px;
    font-weight: bold;
}

/* Pestaña 2 */
.associate-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.drag-word-card {
    background: #9bc48a;
    font-size: clamp(1.8rem, 6vw, 2.6rem);
    font-weight: bold;
    padding: 12px 25px;
    border-radius: 60px;
    box-shadow: 0 6px 0 #567a36;
    color: white;
    cursor: grab;
    text-align: center;
    touch-action: none;
}

.current-word-label {
    background: #ffd89a;
    padding: 10px 20px;
    border-radius: 60px;
    font-size: clamp(1.2rem, 5vw, 2rem);
    font-weight: bold;
    box-shadow: 0 5px 0 #bc7a3a;
    text-align: center;
}

.images-row {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.img-option {
    background: #fff3e0;
    border-radius: 40px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    width: clamp(100px, 25vw, 150px);
    box-shadow: 0 5px 0 #bb884c;
    transition: 0.1s;
    touch-action: manipulation;
}

.img-option:active {
    transform: scale(0.98);
}

.img-emoji {
    font-size: clamp(2.5rem, 8vw, 4rem);
    display: block;
}

/* Pestaña 3 - oraciones */
.sentence-dropzone {
    background: #fff4e0;
    min-width: clamp(80px, 20vw, 120px);
    height: auto;
    padding: 10px;
    font-size: clamp(1rem, 3.5vw, 1.4rem);
}

/* Panel de puntuación */
.score-panel {
    background: #ffecb3;
    border-radius: 40px;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin: 15px 0 10px;
    gap: 10px;
}

.score-box, .lives-box {
    background: white;
    padding: 5px 15px;
    border-radius: 40px;
    font-weight: bold;
    font-size: clamp(1rem, 4vw, 1.2rem);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1), 0 3px 6px rgba(0,0,0,0.1);
}

.highscores {
    background: #fff0d0;
    border-radius: 30px;
    padding: 12px;
    margin-top: 15px;
    text-align: center;
    font-size: clamp(0.8rem, 3vw, 1rem);
}

.highscores table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.highscores th, .highscores td {
    padding: 5px;
    border-bottom: 1px solid #e0b07f;
}

.name-input {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

.name-input input {
    padding: 8px;
    border-radius: 30px;
    border: 1px solid #ccaa77;
    font-family: inherit;
    font-size: 0.9rem;
    width: 130px;
}

.name-input button {
    background: #ffad60;
    border: none;
    padding: 6px 15px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
}

footer {
    font-size: 0.7rem;
    text-align: center;
    margin-top: 25px;
    color: #a86f3c;
}

/* Ajustes extra para móviles muy pequeños */
@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }
    .dropzone-row {
        gap: 8px;
    }
    .syllables-list {
        gap: 8px;
    }
    .btn {
        padding: 8px 16px;
    }
    .tab-btn {
        padding: 6px 12px;
    }
}