@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;600&display=swap');

/* =========================================
   ตัวแปรระบบ (ปรับเป็น Light Mode โทนสว่าง)
========================================= */
:root {
    --primary-color: #00b894; /* สีเขียวมิ้นต์เข้มขึ้นสำหรับจอขาว */
    --secondary-color: #6c5ce7;
    --bg-color: #ffffff;      /* พื้นหลังสีขาว */
    --text-main: #2d3436;     /* ตัวอักษรสีเทาเข้มเกือบดำ */
    --text-muted: #636e72;
    --glass-bg: rgba(255, 255, 255, 0.85); /* กระจกใสสีขาว */
    --glass-border: rgba(0, 0, 0, 0.08);   /* ขอบกระจกเทาอ่อน */
    
    --spring-easing: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --fluid-easing: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Prompt', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%; height: 100%;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden; 
    overscroll-behavior: none; 
}

#app-root {
    position: relative;
    width: 100vw; height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#physics-canvas {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    transform: translateZ(0);
    pointer-events: none;
}

.ui-layer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 2rem 1.5rem;
    /* ไล่สีขาวให้เห็นชัดขึ้นตรงกลาง */
    background: radial-gradient(circle at center, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 100%);
}

header {
    text-align: center; margin-bottom: 2rem;
    animation: fadeDown 0.8s var(--fluid-easing) forwards;
}

.gradient-text {
    font-size: 1.8rem; font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px; margin-bottom: 0.5rem;
}

#system-status { font-size: 0.9rem; color: var(--text-muted); font-weight: 300; }

.chat-container {
    flex: 1; overflow-y: auto;
    display: flex; flex-direction: column; gap: 1rem;
    padding-bottom: 2rem;
    -ms-overflow-style: none; scrollbar-width: none;
}
.chat-container::-webkit-scrollbar { display: none; }

.message {
    padding: 1rem 1.2rem;
    border-radius: 16px;
    max-width: 85%;
    line-height: 1.5; font-size: 0.95rem;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    animation: popIn 0.5s var(--spring-easing) forwards;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02); /* เพิ่มเงาบางๆ */
}

/* สีแชทบอท */
.system-message {
    background: #f8f9fa;
    color: var(--text-main);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* สีแชทผู้ใช้ */
.user-message {
    background: #e6fffa;
    border-color: #b2f5ea;
    color: #005f4f;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    transform-origin: bottom right;
}

.control-panel {
    display: flex; justify-content: center; align-items: center; padding-top: 1rem;
}

/* ปุ่มไมค์แบบสว่าง */
.cyber-button {
    position: relative;
    width: 70px; height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff, #f1f2f6);
    border: 2px solid #dfe4ea;
    color: #747d8c; /* สีเทาตอนปิด */
    cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    outline: none;
    transition: transform 0.3s var(--spring-easing), box-shadow 0.3s ease;
    z-index: 10;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.cyber-button:hover { transform: scale(1.05); }
.cyber-button:active { transform: scale(0.95); transition: transform 0.1s; }

.mic-icon { width: 28px; height: 28px; z-index: 2; transition: color 0.3s ease; }

.cyber-button.listening {
    border-color: var(--primary-color);
    box-shadow: 0 0 25px rgba(0, 184, 148, 0.4); /* แสงสีเขียว */
}

.cyber-button.listening .mic-icon { color: var(--primary-color); }

.btn-glow {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; height: 100%;
    border-radius: 50%;
    background: var(--primary-color);
    opacity: 0; z-index: 1; pointer-events: none;
}

.cyber-button.listening .btn-glow { animation: pulseWave 1.5s infinite ease-out; }

/* Popup UI (ปรับให้เข้ากับจอขาว) */
.install-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999; opacity: 1; transition: opacity 0.3s ease;
}
.install-modal.hidden { opacity: 0; pointer-events: none; }
.install-card {
    background: #ffffff; border: 1px solid #dfe4ea; border-radius: 20px;
    padding: 2rem; max-width: 90%; width: 350px; text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(0) scale(1); transition: transform 0.4s var(--spring-easing);
}
.install-modal.hidden .install-card { transform: translateY(20px) scale(0.9); }
.install-card h2 { color: var(--primary-color); margin-bottom: 1rem; font-size: 1.4rem; }
.install-card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; line-height: 1.5; }
.install-actions { display: flex; flex-direction: column; gap: 0.8rem; }
.install-actions button {
    padding: 12px; border-radius: 12px; border: none;
    font-weight: 600; cursor: pointer; font-size: 1rem; transition: all 0.2s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--primary-color), #00cec9); color: #fff; }
.btn-primary:active { transform: scale(0.95); }
.btn-secondary { background: #f1f2f6; color: var(--text-muted); }

@keyframes fadeDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.8) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes pulseWave { 0% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; } 100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; } }

@media (min-width: 768px) {
    .ui-layer { max-width: 600px; margin: 0 auto; border-left: 1px solid var(--glass-border); border-right: 1px solid var(--glass-border); background: rgba(255,255,255,0.9); }
}