:root {
    --bg-dark: #0a0b10;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-cyan: #00f2fe;
    --accent-green: #00e676;
    --accent-green-dim: rgba(0, 230, 118, 0.3);
    --panel-bg: rgba(15, 23, 42, 0.7);
    --border-glass: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

body::before {
    content: '';
    position: fixed;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background-image: var(--bg-image, none);
    background-size: cover;
    background-position: center;
    filter: blur(20px) brightness(0.4);
    z-index: -2;
    transition: background-image 1s ease-in-out;
    pointer-events: none;
}

/* Background Nebula */
.space-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 45%, #1d69ff 0%, #125df1 50%, #0c4dc7 100%);
}

.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 20px 30px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 40px 70px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 40px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 160px 120px, #ffffff, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: moveStars 60s linear infinite;
    opacity: 0.5;
}

.nebula-blue {
    position: absolute;
    top: -20%;
    left: -10%;
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.12) 0%, transparent 60%);
    filter: blur(60px);
    animation: drift 30s infinite alternate ease-in-out;
}

.nebula-green {
    position: absolute;
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(0, 230, 118, 0.08) 0%, transparent 60%);
    filter: blur(60px);
    animation: drift 40s infinite alternate-reverse ease-in-out;
}

@keyframes moveStars {
    from { transform: translateY(0); }
    to { transform: translateY(-200px); }
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5%, 5%) scale(1.1); }
    100% { transform: translate(-5%, -5%) scale(0.9); }
}

/* Main Avatar Container */
.avatar-container {
    position: relative;
    width: 100%;
    max-width: 520px;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: -65px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 5;
}

body.has-convo-bubble .avatar-container {
    transform: translateY(-22px) scale(0.96);
}

.face-glow {
    position: absolute;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    transition: background 0.5s ease, transform 0.5s ease;
}

#aiku-face {
    width: 300px;
    max-width: 85vw;
    height: auto;
    z-index: 1;
    transition: transform 0.3s ease;
}

/* Cute Pill Visor Elements */
.pill-border {
    transition: fill 0.4s ease, filter 0.4s ease;
}

.pill-face {
    transition: fill 0.4s ease;
}

/* SVG Animations (States) */
.eye-group {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.eye-group ellipse {
    fill: #0a0e1a;
    transition: fill 0.4s ease, rx 0.4s ease, ry 0.4s ease;
}

.eye-highlight {
    transition: cx 0.5s ease, cy 0.5s ease, opacity 0.3s ease;
}

#aiku-mouth {
    fill: #0a0e1a;
    stroke: #0a0e1a;
    stroke-width: 1.5;
    stroke-linejoin: round;
    transform-box: fill-box;
    transform-origin: center;
    transition: d 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s ease;
}

/* State: Idle — blink animation */
@keyframes blink {
    0%, 92%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.08); }
    97% { transform: scaleY(0.4); }
}

body:not(.state-thinking):not(.state-speaking):not(.state-listening):not(.state-music):not(.js-idle-active) .eye-group {
    animation: blink 4s infinite;
}

body:not(.state-thinking):not(.state-speaking):not(.state-listening):not(.state-music) #aiku-face {
    animation: float 4s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-7px) rotate(0.8deg); }
}

/* JS Idle Expressions */
/* Curious: eyes slightly bigger */
.idle-curious .eye-group {
    transform: scale(1.15);
}

/* Happy: squint eyes (cute crescent smile) */
.idle-happy .eye-group {
    transform: scaleY(0.45);
}
.idle-happy #aiku-mouth {
    d: path("M 189 162 Q 200 182 211 162 Z");
}

/* Dreamy: half-closed eyes */
.idle-dreamy .eye-group {
    transform: scaleY(0.4);
}
.idle-dreamy #aiku-mouth {
    d: path("M 193 165 Q 200 172 207 165 Z");
}

/* Look Around & Geleng-Geleng */
.idle-look .eye-group {
    animation: none !important;
}
.idle-look #aiku-face {
    animation: geleng 1.6s ease-in-out;
}

@keyframes geleng {
    0% { transform: translateX(0) rotate(0deg); }
    20% { transform: translateX(-12px) rotate(-2deg); }
    50% { transform: translateX(0) rotate(0deg); }
    80% { transform: translateX(12px) rotate(2deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

/* State: Listening */
body.state-listening .face-glow {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0%, transparent 70%);
    transform: scale(1.2);
}
body.state-listening .eye-group {
    transform: scale(1.1);
}
body.state-listening #aiku-mouth {
    d: path("M 190 162 Q 200 178 210 162 Z");
}

/* State: Thinking */
body.state-thinking .face-glow {
    background: radial-gradient(circle, rgba(255, 193, 7, 0.35) 0%, transparent 70%);
    animation: pulseGlow 2s infinite alternate;
}
body.state-thinking .eye-group {
    transform: scaleY(0.4);
}
body.state-thinking #aiku-mouth {
    d: path("M 194 167 Q 200 167 206 167 Z");
}

/* State: Speaking */
body.state-speaking .face-glow {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, transparent 70%);
}
body.state-speaking #aiku-mouth {
    animation: speakMouth 0.35s infinite alternate ease-in-out;
}

@keyframes speakMouth {
    0% {
        d: path("M 192 163 Q 200 174 208 163 Z");
        transform: scale(0.95);
    }
    50% {
        d: path("M 190 161 Q 200 184 210 161 Z");
        transform: scale(1.18);
    }
    100% {
        d: path("M 191 162 Q 200 178 209 162 Z");
        transform: scale(1.05);
    }
}

/* State: Murottal */
body.state-murottal .face-glow {
    background: radial-gradient(circle, rgba(76, 175, 80, 0.35) 0%, transparent 70%);
    animation: pulseGlow 3s infinite alternate;
}
body.state-murottal .eye-group {
    transform: scaleY(0.5);
}
body.state-murottal #aiku-mouth {
    d: path("M 192 164 Q 200 174 208 164 Z");
}

/* State: Music */
body.state-music .face-glow {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
    animation: musicPulse 1.5s infinite alternate ease-in-out;
}
body.state-music .eye-group {
    transform: scaleY(0.55);
    animation: musicBob 1.2s infinite ease-in-out;
}
body.state-music #aiku-mouth {
    d: path("M 189 162 Q 200 182 211 162 Z");
}
body.state-music #aiku-face {
    animation: musicFloat 1.5s infinite ease-in-out;
}

@keyframes musicPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.15); opacity: 1; }
}
@keyframes musicBob {
    0%, 100% { transform: scaleY(0.55) translateY(0); }
    50% { transform: scaleY(0.6) translateY(-3px); }
}
@keyframes musicFloat {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-6px) rotate(-1deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-6px) rotate(1deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

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

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 1; }
}

/* YouTube Player Container (Hidden but on-screen for mobile init) */
#yt-player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 200px;
    opacity: 0.01;
    pointer-events: none;
    z-index: -1;
}

/* YouTube Search Results UI */
#yt-search-results {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
    transition: opacity 0.3s ease, transform 0.3s ease;
    width: 90%;
    max-width: 600px;
    padding: 10px;
    pointer-events: none; /* hidden by default */
    opacity: 0;
}

#yt-search-results.active {
    pointer-events: auto;
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

#close-yt-search {
    align-self: flex-end;
    background: rgba(255,0,0,0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255,0,0,0.5);
    transition: transform 0.2s;
}
#close-yt-search:hover {
    transform: scale(1.1);
    background: rgba(255,0,0,0.5);
}

.yt-result-item {
    flex: 0 0 auto;
    width: 160px;
    background: rgba(20, 20, 30, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.yt-result-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 242, 254, 0.2);
    border-color: rgba(0, 242, 254, 0.5);
}

.avatar-container.music-playing .avatar-circle {
    box-shadow: 0 0 20px rgba(100, 255, 218, 0.5), 0 0 40px rgba(100, 255, 218, 0.3);
    border-color: #64ffda;
}

@keyframes discoBackground {
    0% { filter: blur(15px) brightness(0.3) hue-rotate(0deg) scale(1); }
    25% { filter: blur(15px) brightness(0.5) hue-rotate(90deg) scale(1.05); }
    50% { filter: blur(15px) brightness(0.3) hue-rotate(180deg) scale(1); }
    75% { filter: blur(15px) brightness(0.6) hue-rotate(270deg) scale(1.02); }
    100% { filter: blur(15px) brightness(0.3) hue-rotate(360deg) scale(1); }
}

/* Background state modifiers */
body.has-bg::before {
    animation: discoBackground 4s infinite alternate;
}

.yt-result-thumb {
    width: 100%;
    height: 90px;
    object-fit: cover;
    background: #000;
}

.yt-result-info {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.yt-result-info p {
    margin: 5px 0 0;
    font-size: 0.8rem;
    color: #b0bec5;
}

/* Qur'an Visualizer */
#quran-visualizer {
    position: fixed;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: rgba(10, 20, 30, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: all 0.5s ease;
}
#quran-visualizer.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}
.quran-arabic {
    font-family: "Amiri", "Lateef", serif; /* standard arabic fonts */
    font-size: 2rem;
    line-height: 1.5;
    color: #64ffda;
    margin-bottom: 10px;
    direction: rtl;
}
.quran-latin {
    font-size: 1rem;
    color: #e0e0e0;
    font-style: italic;
    margin-bottom: 8px;
}
.quran-translation {
    font-size: 0.9rem;
    color: #a0a0a0;
}

.yt-result-title {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.yt-result-duration {
    color: #4facfe;
    font-size: 0.75rem;
    font-weight: 500;
}

.yt-result-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--accent-cyan);
    color: #000;
    font-weight: bold;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}


/* Status Text */
.status-display {
    margin-top: 14px;
    text-align: center;
    min-height: 36px;
    padding: 6px 18px;
    border-radius: 20px;
    background: rgba(10, 20, 45, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    display: inline-block;
    cursor: pointer;
    transition: all 0.3s ease;
}
.status-display:hover {
    background: rgba(10, 20, 45, 0.55);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}
#status-text {
    font-family: 'Outfit', 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.88);
    letter-spacing: 0.3px;
    text-transform: none;
    transition: color 0.3s;
}

body.state-listening #status-text { color: #6ee7b7; font-weight: 600; }
body.state-thinking #status-text { color: #fde047; }
body.state-speaking #status-text { color: #93c5fd; }
body.state-murottal #status-text { color: #a7f3d0; }
body.state-music #status-text { color: #c4b5fd; }

/* Floating Bottom Mic Action Bar */
.bottom-mic-bar {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 100;
}

.mic-btn {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #00f2fe 0%, #0e78f9 100%);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 24px rgba(0, 242, 254, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.mic-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 30px rgba(0, 242, 254, 0.65);
}

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

.mic-btn svg {
    width: 28px;
    height: 28px;
    stroke-width: 2.2;
    transition: transform 0.2s ease;
}

/* Mic Active / Recording State */
.mic-btn.recording {
    background: linear-gradient(135deg, #ff3366 0%, #ff5e3a 100%);
    box-shadow: 0 8px 30px rgba(255, 51, 102, 0.65);
    animation: micPulseRecord 1.4s infinite;
}

@keyframes micPulseRecord {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 51, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(255, 51, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 51, 102, 0);
    }
}

/* Mic Thinking State */
.mic-btn.thinking {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
    animation: micSpinPulse 1.8s infinite linear;
}

@keyframes micSpinPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* Mic Speaking State */
.mic-btn.speaking {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

.mic-label {
    font-size: 0.86rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.3px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    transition: color 0.3s;
    user-select: none;
    white-space: nowrap;
}

/* Settings Button */
.settings-trigger {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--panel-bg);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(10px);
    color: var(--text-muted);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
}

.settings-trigger:hover {
    color: var(--text-main);
    border-color: var(--accent-cyan);
    transform: rotate(90deg);
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s, visibility 0.3s;
}

.settings-modal.hidden {
    opacity: 0;
    visibility: hidden;
}

.settings-content {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-modal.hidden .settings-content {
    transform: translateY(20px);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 16px;
}

.settings-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-header h2 i {
    color: var(--accent-cyan);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--text-main);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="password"], input[type="text"], select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    border-color: var(--accent-cyan);
}

.help-text {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 6px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group.half {
    flex: 1;
}

input[type="range"] {
    width: 100%;
    margin-bottom: 4px;
    accent-color: var(--accent-cyan);
}

.range-value {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    text-align: right;
}

.settings-footer {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
}

.btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), #3b82f6);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}


/* =============================================
   CUTE BLUSH CHEEKS & EXPRESSION STATES
   ============================================= */
.blush-cheek {
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-box: fill-box;
    transform-origin: center;
    filter: drop-shadow(0 0 6px rgba(255, 118, 156, 0.5));
    pointer-events: none;
}
.blush-visible .blush-cheek,
#robot-head.expr-happy .blush-cheek,
#robot-head.expr-proud .blush-cheek,
#robot-head.expr-excited .blush-cheek {
    opacity: 0.85 !important;
    transform: scale(1.2);
}

/* Dynamic Avatar Expressions */
#robot-head {
    transform-origin: 200px 150px;
    transform-box: fill-box;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Speaking Cadence (Natural Nodding & Syllables) */
body.state-speaking #robot-head,
#robot-head.is-speaking {
    animation: headSpeakingNod 2.4s infinite ease-in-out !important;
}
@keyframes headSpeakingNod {
    0% { transform: translateY(0) rotate(0deg); }
    20% { transform: translateY(-4px) rotate(-1.5deg); }
    40% { transform: translateY(3px) rotate(1deg); }
    65% { transform: translateY(-2px) rotate(-0.8deg); }
    85% { transform: translateY(2px) rotate(0.6deg); }
    100% { transform: translateY(0) rotate(0deg); }
}
body.state-speaking #aiku-mouth,
#robot-head.is-speaking #aiku-mouth {
    animation: speakMouthRealistic 0.38s infinite ease-in-out alternate !important;
}
@keyframes speakMouthRealistic {
    0% {
        d: path("M 192 163 Q 200 174 208 163 Z");
        transform: scale(0.95);
    }
    30% {
        d: path("M 188 161 Q 200 186 212 161 Z");
        transform: scale(1.22);
    }
    65% {
        d: path("M 194 164 Q 200 171 206 164 Z");
        transform: scale(0.9);
    }
    100% {
        d: path("M 189 161 Q 200 180 211 161 Z");
        transform: scale(1.15);
    }
}

/* Happy / Encouraging Expression */
#robot-head.expr-happy {
    animation: headHappyBounce 1.5s infinite ease-in-out alternate;
}
#robot-head.expr-happy .eye-group {
    transform: scaleY(0.42) translateY(-3px) !important;
}
#robot-head.expr-happy #aiku-mouth {
    d: path("M 186 161 Q 200 186 214 161 Z") !important;
    transform: scale(1.2);
}
@keyframes headHappyBounce {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(1.2deg); }
    100% { transform: translateY(0) rotate(-1deg); }
}

/* Proud / Well Done Expression */
#robot-head.expr-proud {
    animation: headProudNod 1.8s ease-in-out;
}
#robot-head.expr-proud .eye-group {
    transform: scale(1.18) !important;
}
#robot-head.expr-proud #aiku-mouth {
    d: path("M 188 162 Q 200 182 212 162 Z") !important;
}
@keyframes headProudNod {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-7px) rotate(2deg); }
    50% { transform: translateY(4px) rotate(0deg); }
    75% { transform: translateY(-2px) rotate(1deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

/* Thinking Expression */
#robot-head.expr-thinking {
    transform: translateY(-4px) rotate(-4.5deg);
}
#robot-head.expr-thinking .eye-group {
    transform: scaleY(0.65) translateY(-3px) !important;
}
#robot-head.expr-thinking #aiku-mouth {
    d: path("M 194 166 Q 200 166 206 166 Z") !important;
}

/* Excited Expression */
#robot-head.expr-excited {
    animation: headExcitedBob 0.85s infinite ease-in-out alternate;
}
#robot-head.expr-excited .eye-group {
    transform: scale(1.22) !important;
}
#robot-head.expr-excited #aiku-mouth {
    d: path("M 186 160 Q 200 188 214 160 Z") !important;
}
@keyframes headExcitedBob {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-9px) scale(1.03); }
}

/* Curious Expression */
#robot-head.expr-curious {
    transform: translateY(-3px) rotate(3.5deg);
}
#robot-head.expr-curious .left-eye {
    transform: scale(1.2) !important;
}
#robot-head.expr-curious .right-eye {
    transform: scale(0.95) !important;
}
#robot-head.expr-curious #aiku-mouth {
    d: path("M 192 163 Q 200 173 208 163 Z") !important;
}

/* =============================================
   MODE SWITCHER (GoPrep vs Companion)
   ============================================= */
.mode-switcher-bar {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    background: rgba(10, 15, 30, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
    z-index: 30;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45), inset 0 0 10px rgba(255, 255, 255, 0.04);
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.mode-btn svg,
.mode-btn i {
    width: 15px;
    height: 15px;
    transition: transform 0.2s ease;
}

.mode-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.mode-btn.active {
    background: linear-gradient(135deg, #00f2fe, #3b82f6);
    color: #030712;
    font-weight: 700;
    box-shadow: 0 4px 18px rgba(0, 242, 254, 0.4);
}

.mode-btn.active svg,
.mode-btn.active i {
    transform: scale(1.1);
}

/* GoPrep mode special theme tint */
body.mode-goprep {
    --accent-primary: #10b981;
}
body.mode-goprep .mode-btn#btnModeGoPrep.active {
    background: linear-gradient(135deg, #34d399, #059669);
    color: #ffffff;
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.45);
}

/* =============================================
   LIVE TRANSCRIPT & GOPREP FEEDBACK BUBBLE
   ============================================= */
.convo-bubble-container {
    position: fixed;
    bottom: 115px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 440px;
    max-height: 210px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 25;
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.3s ease;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.convo-bubble-container::-webkit-scrollbar {
    width: 4px;
}
.convo-bubble-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.convo-bubble-container.hidden {
    display: none !important;
}

.convo-bubble-close {
    position: sticky;
    top: 0;
    align-self: flex-end;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(20, 28, 48, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    margin-bottom: -4px;
}
.convo-bubble-close:hover {
    color: #ffffff;
    background: rgba(239, 68, 68, 0.8);
    transform: scale(1.1);
}
.convo-bubble-close svg,
.convo-bubble-close i {
    width: 12px;
    height: 12px;
}

.speech-bubble {
    padding: 9px 14px;
    border-radius: 14px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font-size: 0.88rem;
    line-height: 1.4;
    animation: bubbleFadeIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    transition: all 0.25s ease;
}

.speech-bubble.hidden {
    display: none !important;
}

@keyframes bubbleFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.bubble-header {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    opacity: 0.85;
}

.bubble-header svg,
.bubble-header i {
    width: 12px;
    height: 12px;
}

.bubble-text {
    margin: 0;
    word-break: break-word;
}

.user-bubble {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f1f5f9;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
    max-width: 85%;
}

.user-bubble .bubble-header {
    color: #94a3b8;
}

.ai-bubble {
    background: rgba(12, 22, 42, 0.9);
    border: 1px solid rgba(0, 242, 254, 0.35);
    color: #ffffff;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 95%;
}

body.mode-goprep .ai-bubble {
    border-color: rgba(52, 211, 153, 0.45);
}

.ai-bubble .bubble-header {
    color: #38bdf8;
}

body.mode-goprep .ai-bubble .bubble-header {
    color: #34d399;
}

/* GoPrep Smart Feedback Box */
.goprep-feedback {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(52, 211, 153, 0.45);
    border-radius: 10px;
    animation: feedbackPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.goprep-feedback.hidden {
    display: none !important;
}

@keyframes feedbackPop {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.feedback-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #34d399;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.feedback-badge svg,
.feedback-badge i {
    width: 12px;
    height: 12px;
}

.feedback-text {
    margin: 0;
    font-size: 0.85rem;
    color: #ecfdf5;
    font-weight: 500;
    line-height: 1.35;
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
    .mode-switcher-bar {
        top: 14px;
        padding: 3px;
    }
    .mode-btn {
        padding: 6px 13px;
        font-size: 0.75rem;
    }
    .avatar-container {
        margin-top: -45px;
    }
    #aiku-face {
        width: 270px;
        max-width: 82vw;
    }
    .convo-bubble-container {
        bottom: 102px;
        width: calc(100% - 24px);
        max-height: 175px;
    }
    .speech-bubble {
        font-size: 0.82rem;
        padding: 8px 11px;
    }
}
