* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #2d3748;
    padding: 2rem 0;
}

@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: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 95%;
    max-width: 900px;
    text-align: center;
}

header {
    margin-bottom: 2rem;
}

header h1 {
    font-size: 3rem;
    color: #4fd1c5;
    text-shadow: 2px 2px 0px #fff;
    font-weight: 800;
}

#goal-title {
    font-size: 1.8rem;
    color: #ed8936;
    margin-bottom: 0.5rem;
}

.task-listen-btn {
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    vertical-align: middle;
    margin-left: 10px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.task-listen-btn:hover {
    transform: scale(1.15);
    background: #fdfbfb;
}

header p {
    font-size: 1.1rem;
    color: #718096;
}

.game-area {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #fff;
    padding: 2rem;
    border-radius: 20px;
    margin-bottom: 2rem;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

.robot-container {
    position: relative;
    text-align: center;
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.robot {
    font-size: 6rem;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.robot.happy {
    transform: translateY(-20px) scale(1.1);
    animation: bounce 0.5s;
}

.robot.sad {
    animation: shake 0.5s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

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

.speech-bubble {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #fff;
    border: 3px solid #cbd5e0;
    padding: 0.8rem 1.2rem;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    width: max-content;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 10;
}

.speech-bubble.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 15px 15px 0;
    border-style: solid;
    border-color: #cbd5e0 transparent transparent transparent;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 12px 12px 0;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    z-index: 1;
}

.inventory {
    text-align: center;
}

.inventory h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: #4a5568;
}

.slots {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.slot {
    width: 70px;
    height: 70px;
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    background: #f7fafc;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.slot.filled {
    border-style: solid;
    border-color: #48bb78;
    background: #f0fff4;
    transform: scale(1.1);
    color: #333;
}

.materials-title {
    font-size: 1.6rem;
    color: #2d3748;
    font-weight: 700;
}
.materials-subtitle {
    font-size: 1rem;
    color: #718096;
    margin-bottom: 1.5rem;
}

.materials-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.2rem;
}

.material-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.listen-btn {
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.listen-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.material-wrapper.used {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(100%);
}

.material-card {
    background: #fff;
    border: 3px solid transparent;
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.2s;
    min-width: 110px;
}

.material-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    border-color: #4fd1c5;
}

.material-card.used {
    background: #edf2f7;
    opacity: 0.5;
    pointer-events: none;
    transform: scale(0.95);
    box-shadow: none;
}

.material-emoji {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.material-name {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #4a5568;
}

.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: 1000;
}

.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);
    transform: translateY(20px); transition: transform 0.4s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-content h2 { font-size: 2.5rem; color: #2d3748; }

#next-btn, #restart-btn {
    background: #4fd1c5; color: white; border: none;
    padding: 1rem 2.5rem; font-size: 1.2rem; font-weight: 700;
    border-radius: 50px; cursor: pointer; transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(79, 209, 197, 0.4);
    margin-top: 1rem;
}
#next-btn:hover, #restart-btn:hover {
    background: #38b2ac; transform: translateY(-2px);
}

@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 { margin-bottom: 0; }
    header h1 { font-size: 2rem; margin-bottom: 0.2rem; }
    #goal-title { font-size: 1.3rem; margin-bottom: 0; }
    header p { display: none; }
    .task-listen-btn { width: 40px; height: 40px; font-size: 1.3rem; }
    
    .game-area { flex-direction: row; gap: 1rem; padding: 1rem; margin-bottom: 0; justify-content: space-evenly; flex: 1; max-height: 25vh; }
    .robot-container { width: 90px; height: 90px; }
    .robot { font-size: 4rem; }
    .inventory h3 { font-size: 1rem; margin-bottom: 0.5rem; }
    .slots { gap: 0.5rem; }
    .slot { width: 45px; height: 45px; font-size: 1.8rem; border-radius: 10px; border-width: 2px; }
    
    .materials-title { font-size: 1.3rem; margin-bottom: 0.5rem; }
    .materials-subtitle { display: none; }
    .materials-grid { gap: 0.8rem; padding-bottom: 0; justify-content: center; }
    .material-card { min-width: 75px; padding: 0.8rem; border-radius: 12px; border-width: 2px; }
    .material-emoji { font-size: 2rem; margin-bottom: 0.2rem; }
    .material-name { font-size: 0.9rem; }
    .listen-btn { width: 32px; height: 32px; font-size: 1rem; }
}
