/* =========================================
   1. CORE LAYOUT (BRIGHT & FRESH THEME)
   ========================================= */
#ak-game-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px; /* Gọn hơn để đẹp trên mobile */
    margin: 0 auto;
    min-height: 650px;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(137, 107, 240, 0.4); /* Bóng màu tím nhạt */
    font-family: 'Quicksand', 'Segoe UI', sans-serif; /* Font chữ bo tròn thân thiện */
    color: #4a4a4a;
    /* Màu nền dự phòng tươi sáng */
    background: #fad0c4; 
    box-sizing: border-box;
}

#ak-3d-background {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0;
    /* Gradient Pastel: Xanh dương nhạt -> Tím hồng -> Cam đào */
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
}

.ak-game-container {
    position: relative; z-index: 1; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 20px;
    /* Hiệu ứng kính mờ sáng hơn */
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* =========================================
   2. HEADER & SCORE
   ========================================= */
.ak-header { text-align: center; color: #fff; margin-bottom: 15px; flex-shrink: 0; }

.header-top {
    display: flex; justify-content: center; align-items: center; gap: 15px; margin-bottom: 8px;
}

.ak-badge {
    background: #ff9a9e; /* Màu hồng cam */
    padding: 5px 15px; border-radius: 50px;
    font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(255, 154, 158, 0.4);
}

.ak-score-box {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    padding: 5px 15px;
    border-radius: 50px;
    display: flex; align-items: center; gap: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    font-weight: bold;
}
.score-value { color: #e53e3e; font-size: 1.1rem; }

.ak-header h2 { 
    margin: 0; font-size: 1.6rem; font-weight: 800; 
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1); /* Chữ nổi nhẹ */
}

/* =========================================
   3. STAGE AREA
   ========================================= */
.ak-stage {
    display: flex; justify-content: space-between; align-items: center;
    flex-grow: 1; padding: 10px; gap: 10px;
}

.ak-char-group { display: flex; flex-direction: column; width: 40%; position: relative; transition: all 0.3s; }
.ak-char-group.left { align-items: flex-start; }
.ak-char-group.right { align-items: flex-end; }

.ak-char-card {
    background: #fff; border-radius: 20px; padding: 10px;
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 10px 25px rgba(161, 140, 209, 0.2);
    animation: float 4s ease-in-out infinite;
    max-width: 100%;
}
.ak-char-group.right .ak-char-card { flex-direction: row-reverse; text-align: right; animation-delay: 2s; }

.char-avatar img { width: 55px; height: 55px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.char-meta h3 { margin: 0; font-size: 0.9rem; color: #444; font-weight: 700; }
.char-meta .role { font-size: 0.75rem; color: #888; }

.char-bubble {
    margin-top: 10px; padding: 12px 18px; border-radius: 18px;
    font-size: 0.95rem; line-height: 1.4; color: #555; background: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    opacity: 0; transform: translateY(10px); transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 180px;
}
.ak-char-group.left .char-bubble { border-top-left-radius: 0; background: #fff; }
.ak-char-group.right .char-bubble { border-top-right-radius: 0; background: #e0c3fc; color: #5b3a7d; } /* Tím nhạt cho mẹ */

.char-bubble.active { opacity: 1; transform: translateY(0); }

/* VS Badge */
.ak-vs-area { display: flex; justify-content: center; align-items: center; }
.vs-circle {
    width: 35px; height: 35px; background: #ff6b6b; color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 0.8rem;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.5); animation: pulse 2s infinite;
}

/* =========================================
   4. INTERACTION & FEEDBACK
   ========================================= */
.ak-interaction-panel {
    background: #fff; padding: 20px; border-radius: 25px;
    box-shadow: 0 -10px 30px rgba(161, 140, 209, 0.15); margin-top: 15px;
}

#ak-feedback-area { 
    margin-bottom: 15px; padding: 10px; border-radius: 10px; background: #fff9c4; 
    border: 2px dashed #f6e05e; 
}
.feedback-score { font-weight: 800; color: #d69e2e; margin-right: 5px; }
.feedback-text { color: #555; font-style: italic; }

.ak-status-log { font-size: 0.9rem; color: #666; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

.ak-controls {
    display: flex; gap: 10px; 
    background: #f3f4f6; padding: 8px; border-radius: 15px; 
}

#player-input { 
    flex-grow: 1; border: none; background: transparent; padding: 10px; 
    font-size: 1rem; color: #333; outline: none; 
}

.ak-btn {
    border: none; 
    /* Gradient Tím - Hồng */
    background: linear-gradient(45deg, #84fab0 0%, #8fd3f4 100%); /* Xanh ngọc tươi mát */
    background: linear-gradient(to right, #f83600 0%, #f9d423 100%); /* Cam vàng rực rỡ */
    background: linear-gradient(to right, #667eea, #764ba2); /* Tím đậm cũ - Đổi sang màu tươi hơn */
    background: linear-gradient(90deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%); /* Hồng Pastel */
    background: linear-gradient(120deg, #a18cd1 0%, #fbc2eb 100%); /* Tím hồng */
    
    color: white; padding: 12px 25px; border-radius: 12px; cursor: pointer; font-weight: 700;
    box-shadow: 0 5px 15px rgba(161, 140, 209, 0.4);
    transition: transform 0.2s;
    white-space: nowrap;
}
.ak-btn:hover { transform: scale(1.05); }

.ak-credit { 
    text-align: center; font-size: 0.8rem; color: #ff9a9e; margin-top: 15px; font-weight: 600; 
    text-transform: uppercase; letter-spacing: 1px;
}

/* =========================================
   5. MOBILE RESPONSIVE (TỐI ƯU ĐIỆN THOẠI)
   ========================================= */
@media (max-width: 768px) {
    #ak-game-wrapper { min-height: auto; border-radius: 20px; }
    .ak-game-container { padding: 15px; }
    
    .ak-header h2 { font-size: 1.3rem; }
    
    .ak-stage { flex-direction: column; gap: 15px; }
    .ak-char-group { width: 100%; flex-direction: row; align-items: flex-start; }
    .ak-char-group.right { flex-direction: row-reverse; }
    
    .ak-char-card { padding: 5px 10px; border-radius: 50px; box-shadow: none; background: rgba(255,255,255,0.8); }
    .char-meta { display: none; } /* Ẩn tên trên mobile cho gọn */
    .char-avatar img { width: 45px; height: 45px; }
    
    .char-bubble { margin: 0 10px; padding: 12px; font-size: 0.9rem; border-radius: 15px; width: auto; min-width: auto; flex: 1; }
    
    .ak-controls { flex-direction: column; background: transparent; padding: 0; }
    #player-input { background: #fff; border-radius: 12px; padding: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
    .ak-btn { width: 100%; justify-content: center; margin-top: 5px; padding: 15px; }
}

/* Animations */
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
@keyframes pulse { 0%{transform:scale(1)} 50%{transform:scale(1.1)} 100%{transform:scale(1)} }
@keyframes floatUp { 0%{transform:translateY(0);opacity:1} 100%{transform:translateY(-30px);opacity:0} }