* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #1a1a2e;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: -apple-system, 'PingFang SC', sans-serif;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 20px;
    width: 100%;
    max-width: 500px;
}

/* === ROBOT FACE === */
.robot {
    position: relative;
    width: 260px;
    height: 260px;
    transition: transform 0.3s;
}

.robot-screen {
    width: 240px;
    height: 240px;
    background: radial-gradient(circle at 50% 45%, #16213e, #0a0a1a);
    border-radius: 50%;
    position: absolute;
    top: 10px;
    left: 10px;
    box-shadow:
        0 0 30px rgba(100, 200, 255, 0.15),
        inset 0 0 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* === EYES === */
.eye {
    position: absolute;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    top: 80px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eye-left { left: 58px; }
.eye-right { right: 58px; }

.eye-glow {
    width: 36px;
    height: 36px;
    background: radial-gradient(circle at 40% 35%, #e0f7fa, #80deea, #4dd0e1);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(77, 208, 225, 0.6), 0 0 40px rgba(77, 208, 225, 0.3);
    transition: all 0.3s;
}

/* === MOUTH (SVG) === */
.mouth {
    position: absolute;
    bottom: 60px;
    width: 60px;
    height: 30px;
}

#mouth-svg {
    width: 100%;
    height: 100%;
}

#mouth-path {
    transition: d 0.3s;
}

/* === IDLE ANIMATION === */
.robot.idle {
    animation: idle-float 4s ease-in-out infinite;
}

.robot.idle .eye-glow {
    animation: blink 4s ease-in-out infinite;
}

.robot.idle .robot-screen {
    animation: screen-glow 4s ease-in-out infinite;
}

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

@keyframes blink {
    0%, 42%, 48%, 100% { transform: scaleY(1); }
    45% { transform: scaleY(0.08); }
}

@keyframes screen-glow {
    0%, 100% { box-shadow: 0 0 30px rgba(100, 200, 255, 0.15), inset 0 0 40px rgba(0,0,0,0.5); }
    50% { box-shadow: 0 0 40px rgba(100, 200, 255, 0.25), inset 0 0 40px rgba(0,0,0,0.5); }
}

/* === LISTENING ANIMATION === */
.robot.listening .eye-glow {
    animation: listen-pulse 1s ease-in-out infinite;
    background: radial-gradient(circle at 40% 35%, #fff, #80deea, #26c6da);
}

.robot.listening .robot-screen {
    box-shadow: 0 0 50px rgba(100, 200, 255, 0.35), inset 0 0 40px rgba(0,0,0,0.5);
}

@keyframes listen-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(77, 208, 225, 0.6); }
    50% { transform: scale(1.1); box-shadow: 0 0 30px rgba(77, 208, 225, 0.9); }
}

/* === THINKING ANIMATION === */
.robot.thinking .eye-glow {
    animation: think-spin 1.2s linear infinite;
    width: 30px;
    height: 30px;
}

.robot.thinking {
    animation: think-tilt 2s ease-in-out infinite;
}

.robot.thinking .robot-screen {
    box-shadow: 0 0 40px rgba(255, 183, 77, 0.3), inset 0 0 40px rgba(0,0,0,0.5);
}

.robot.thinking .eye-glow {
    background: radial-gradient(circle at 40% 35%, #fff9c4, #ffb74d, #ffa726);
    box-shadow: 0 0 20px rgba(255, 183, 77, 0.6);
}

@keyframes think-spin {
    0% { transform: translate(6px, 0); }
    25% { transform: translate(0, -6px); }
    50% { transform: translate(-6px, 0); }
    75% { transform: translate(0, 6px); }
    100% { transform: translate(6px, 0); }
}

@keyframes think-tilt {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

/* === EXCITED ANIMATION === */
.robot.excited {
    animation: excited-bounce 0.5s ease-in-out infinite;
}

.robot.excited .eye-glow {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at 40% 35%, #fff, #f48fb1, #ec407a);
    box-shadow: 0 0 25px rgba(236, 64, 122, 0.7);
    animation: excited-sparkle 0.6s ease-in-out infinite;
}

.robot.excited .robot-screen {
    box-shadow: 0 0 50px rgba(236, 64, 122, 0.3), inset 0 0 40px rgba(0,0,0,0.5);
}

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

@keyframes excited-sparkle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* === CONFUSED ANIMATION === */
.robot.confused {
    animation: confused-tilt 2.5s ease-in-out infinite;
}

.robot.confused .eye-glow {
    width: 28px;
    height: 28px;
    background: radial-gradient(circle at 40% 35%, #fff, #b0bec5, #78909c);
    box-shadow: 0 0 15px rgba(120, 144, 156, 0.5);
}

@keyframes confused-tilt {
    0%, 100% { transform: rotate(-8deg); }
    50% { transform: rotate(4deg); }
}

/* === SPEECH BUBBLE === */
.speech-bubble {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 16px 24px;
    font-size: 22px;
    font-weight: 600;
    color: #333;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
    text-align: center;
    max-width: 350px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s, transform 0.3s;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid rgba(255, 255, 255, 0.95);
}

.speech-bubble.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.speech-bubble .name-highlight {
    color: #e91e63;
    font-size: 28px;
}

/* === HINT TEXT === */
.hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    text-align: center;
    animation: hint-fade 3s ease-in-out infinite;
}

@keyframes hint-fade {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

.hint.hidden { display: none; }

/* === MAIN BUTTON (backup) === */
.main-btn {
    background: linear-gradient(135deg, #4dd0e1, #00acc1);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 20px 50px;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(0, 172, 193, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-width: 280px;
}

.main-btn:active {
    transform: scale(0.95);
    box-shadow: 0 3px 12px rgba(0, 172, 193, 0.3);
}

.main-btn:disabled {
    background: linear-gradient(135deg, #555, #444);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    cursor: default;
}

.main-btn.celebrate {
    background: linear-gradient(135deg, #ec407a, #ab47bc);
    box-shadow: 0 6px 25px rgba(171, 71, 188, 0.4);
    animation: btn-pulse 1s ease-in-out infinite;
}

.main-btn.hidden {
    display: none;
}

@keyframes btn-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* === LISTENING INDICATOR === */
.listening-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
}

.listening-indicator.hidden { display: none; }

.mic-icon {
    font-size: 24px;
    animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* === CONTROL PANEL === */
.control-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.98);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: opacity 0.3s, transform 0.3s;
}

.control-panel.hidden {
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 20px;
    font-size: 22px;
    font-weight: 700;
    color: #e0e0e0;
}

.panel-close {
    background: rgba(255,255,255,0.15);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 8px 20px;
    font-size: 16px;
    cursor: pointer;
}

.children-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.child-btn {
    background: linear-gradient(135deg, #4dd0e1, #00acc1);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 15px 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s;
}

.child-btn:active {
    transform: scale(0.92);
}

/* === CONFETTI === */
.confetti {
    position: fixed;
    top: -10px;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confetti-fall 3s linear forwards;
    z-index: 50;
    pointer-events: none;
}

@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Responsive */
@media (max-height: 700px) {
    .robot { width: 200px; height: 200px; }
    .robot-screen { width: 180px; height: 180px; top: 10px; left: 10px; }
    .eye { width: 36px; height: 36px; top: 60px; }
    .eye-left { left: 44px; }
    .eye-right { right: 44px; }
    .eye-glow { width: 30px; height: 30px; }
    .mouth { bottom: 45px; width: 50px; height: 25px; }
    .speech-bubble { font-size: 18px; padding: 12px 18px; }
    .main-btn { font-size: 20px; padding: 16px 40px; }
}
