:root {
    --bg-color-top: #c0f1f9;
    --bg-color-bottom: #ffeeb2;
    --primary-btn: #ff8c42;
    --text-color: #333;
}

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

body {
    background: linear-gradient(180deg, var(--bg-color-top) 0%, var(--bg-color-bottom) 100%);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    max-width: 500px;
    padding: 40px 20px;
}

#character-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 350px;
    max-height: 350px;
}

#robot-face {
    width: 250px;
    height: 250px;
    transition: all 0.3s ease;
}

/* Animations cho SVG Face */
.idle #robot-face {
    animation: float 3s ease-in-out infinite;
}

.listening #robot-face .eye {
    fill: #2ed573;
    transform: scale(1.2);
    transform-origin: center;
}
.listening #robot-face #antenna-light {
    fill: #ff4757;
    animation: blink 0.5s infinite;
}

.speaking #robot-face .mouth {
    animation: talk 0.3s infinite alternate;
}
.speaking #robot-face #antenna-light {
    fill: #ff8c42;
    animation: blink 0.2s infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes talk {
    0% { d: path("M 80 120 Q 100 140 120 120"); }
    100% { d: path("M 80 120 Q 100 110 120 120"); }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#status-text { font-size: 1.2rem; font-weight: bold; color: #555; margin-bottom: 20px; text-align: center; }
#controls { padding-bottom: 30px; }

#mic-btn {
    background-color: var(--primary-btn);
    border: none;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 20px rgba(255, 140, 66, 0.4);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 auto;
    -webkit-tap-highlight-color: transparent;
}
#mic-btn svg { width: 60px; height: 60px; }
#mic-btn:active { transform: scale(0.95); }

#app-container.listening #mic-btn { background-color: #ff4757; animation: pulse 1.5s infinite; }
#app-container.speaking #mic-btn { background-color: #2ed573; }

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 20px rgba(255, 71, 87, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

/* Modal */
#settings-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: white; padding: 30px; border-radius: 20px; box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    z-index: 100; width: 90%; max-width: 400px; text-align: center;
}
#settings-modal input { width: 100%; padding: 12px; margin-bottom: 20px; border: 2px solid #ccc; border-radius: 10px;}
#settings-modal button { padding: 10px 20px; border: none; border-radius: 10px; cursor: pointer; margin: 5px; }
#save-settings { background: #2ed573; color: white; font-weight: bold;}
