:root {
    --pink: #FF6B9D;
    --green: #4CAF50;
    --text: #333;
    --text-light: #8A8A8A;
    --bg: #F5F5F5;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow: 0 4px 12px rgba(0,0,0,0.1);
    --user-bubble: #E8F5E9;
    --robot-bubble: #fff;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* ========== SCREENS ========== */
.screen { display: none; }
.screen.active { display: flex; }

#splash-screen {
    display: none !important;
}

/* ========== WELCOME SCREEN ========== */
#welcome-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    background: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 50%, #B8F0F0 100%);
}

.welcome-content {
    text-align: center;
    padding: 40px 20px;
}

.welcome-content .toy-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.welcome-content h1 {
    font-size: 36px;
    color: var(--pink);
    margin-bottom: 12px;
}

.welcome-content .subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.welcome-content input {
    width: 100%;
    max-width: 300px;
    padding: 16px 20px;
    border: 2px solid #E0E0E0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    margin-bottom: 15px;
    text-align: center;
}

.welcome-content input:focus {
    border-color: var(--pink);
}

.btn {
    padding: 14px 40px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
}

.btn.primary {
    background: var(--pink);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255,107,157,0.4);
}

.welcome-content .hint {
    font-size: 12px;
    color: #999;
    margin-top: 25px;
}

/* ========== CHAT SCREEN ========== */
#chat-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    flex-direction: column;
    background: var(--bg);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #fff;
    border-bottom: 1px solid #E8E8E8;
    flex-shrink: 0;
}

.child-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.child-info .avatar {
    font-size: 28px;
}

.child-info .name {
    font-size: 16px;
    font-weight: bold;
}

.level-badge {
    background: var(--pink);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.top-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #F5F5F5;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    background: #fff;
    font-size: 12px;
    color: var(--text-light);
    border-bottom: 1px solid #E8E8E8;
    flex-shrink: 0;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ========== CHAT AREA ========== */
.chat-area {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 15px 10px 100px;
}

.message {
    display: flex;
    margin-bottom: 14px;
    align-items: flex-end;
}

.message.user {
    flex-direction: row-reverse;
}

.message .avatar {
    font-size: 32px;
    margin: 0 8px;
    flex-shrink: 0;
}

.message .content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.robot .content {
    background: var(--robot-bubble);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow);
}

.message.user .content {
    background: var(--user-bubble);
    border-bottom-right-radius: 4px;
}

.message .time {
    font-size: 10px;
    color: #aaa;
    margin-top: 4px;
}

.message.user .time {
    text-align: right;
}

/* ========== INPUT AREA ========== */
.input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: #FAFAFA;
    border-top: 1px solid #E8E8E8;
    z-index: 100;
}

.voice-btn-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.voice-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: linear-gradient(135deg, var(--green), #45a049);
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.voice-btn:active,
.voice-btn.recording {
    background: linear-gradient(135deg, #FF6B6B, #EE5A5A);
    transform: scale(0.95);
}

.voice-btn.recording {
    animation: pulse-record 1s ease infinite;
}

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

.voice-hint {
    font-size: 10px;
    color: var(--text-light);
}

.text-input-container {
    flex: 1;
    display: flex;
    gap: 8px;
}

.text-input-container input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #E8E8E8;
    border-radius: 20px;
    font-size: 15px;
    outline: none;
    min-width: 0;
}

.send-btn {
    padding: 8px 18px;
    background: var(--pink);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.5;
}

.send-btn.active {
    opacity: 1;
}

/* ========== MODALS ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    max-width: 360px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.modal-header h2 {
    font-size: 18px;
}

.close-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: #F5F5F5;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
}

/* ========== TOAST ========== */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.active {
    opacity: 1;
}