body {
    margin: 0;
    height: 100vh;
    background: #0a0a23;
    overflow: hidden;
    position: relative;
    font-family: Arial, sans-serif;
    transition: filter 0.5s ease;
}

body.time-warp {
    filter: blur(5px) grayscale(50%);
    animation: time-warp-bg 2s infinite;
}

@keyframes time-warp-bg {
    0% { filter: blur(5px) grayscale(50%) brightness(1); }
    50% { filter: blur(5px) grayscale(50%) brightness(0.7); }
    100% { filter: blur(5px) grayscale(50%) brightness(1); }
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 3px);
    background-size: 20px 20px;
    opacity: 0.3;
    animation: twinkle 5s infinite;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    50% { opacity: 0.5; }
    100% { opacity: 0.3; }
}

.robot {
    position: absolute;
    width: 10vw;
    height: 15vw;
    max-width: 100px;
    max-height: 150px;
    cursor: pointer;
    --robot-color: #00ffcc;
    transition: animation-duration 0.5s ease;
}

.robot.time-warp {
    animation-duration: 8s;
}

.robot:hover {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

.robot::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    background: #ff4500;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: trail 2s infinite;
    z-index: -1;
}

@keyframes trail {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(3); }
}

.head {
    width: 60%;
    height: 40%;
    background: var(--robot-color);
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 20%;
    animation: glow 2s infinite alternate, tilt 3s infinite;
}

.eyes {
    width: 15%;
    height: 15%;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 40%;
    animation: blink 4s infinite, eye-glow 2s infinite alternate;
}

.eyes.left { left: 20%; }
.eyes.right { right: 20%; }

.antenna {
    width: 5%;
    height: 20%;
    background: var(--robot-color);
    position: absolute;
    top: -20%;
    left: 47.5%;
    animation: wobble 1s infinite;
}

.spin-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid var(--robot-color); /* Use robot's current color */
    border-radius: 50%;
    opacity: 0;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 1s ease;
}

.spin-ring.active {
    opacity: 1;
    transform: scale(1.5);
    animation: spin-ring-glow 1s ease;
}

@keyframes spin-ring-glow {
    0% { box-shadow: 0 0 5px var(--robot-color), 0 0 10px var(--robot-color); }
    50% { box-shadow: 0 0 15px var(--robot-color), 0 0 30px var(--robot-color); }
    100% { box-shadow: 0 0 5px var(--robot-color), 0 0 10px var(--robot-color); }
}

.speech-bubble {
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a3d;
    color: #fff;
    padding: 10px;
    border-radius: 10px;
    font-size: 12px;
    display: none;
    white-space: nowrap;
    border: 2px solid #ff4500;
    box-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
}

.speech-bubble.alien {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #ff4500;
}

.body {
    width: 50%;
    height: 47%;
    background: #00cc99;
    position: absolute;
    top: 33%;
    left: 25%;
    border-radius: 20px;
}

.arms, .legs {
    width: 10%;
    height: 27%;
    background: var(--robot-color);
    position: absolute;
}

.arms.left { 
    top: 33%; 
    left: 10%; 
    transform: rotate(20deg); 
    animation: wave 2s infinite; 
}
.arms.right { 
    top: 33%; 
    right: 10%; 
    transform: rotate(-20deg); 
    animation: wave 2s infinite alternate; 
}
.legs.left { 
    top: 73%; 
    left: 20%; 
    transform: rotate(10deg); 
    animation: kick 1.5s infinite; 
}
.legs.right { 
    top: 73%; 
    right: 20%; 
    transform: rotate(-10deg); 
    animation: kick 1.5s infinite alternate; 
}

.hand {
    width: 50%;
    height: 20%;
    background: var(--robot-color);
    border-radius: 50%;
    position: absolute;
    bottom: -10%;
    left: 25%;
    animation: grip 1s infinite;
}

.foot {
    width: 50%;
    height: 20%;
    background: var(--robot-color);
    border-radius: 50%;
    position: absolute;
    bottom: -10%;
    left: 25%;
    animation: tap 1s infinite;
}

/* Animations for body parts */
@keyframes glow {
    0% { box-shadow: 0 0 5px #ff4500, 0 0 10px #ff4500; }
    100% { box-shadow: 0 0 20px #ff4500, 0 0 40px #ff4500; }
}

@keyframes eye-glow {
    0% { box-shadow: 0 0 2px #fff; }
    100% { box-shadow: 0 0 8px #fff; }
}

@keyframes wobble {
    0% { transform: rotate(10deg); }
    50% { transform: rotate(-10deg); }
    100% { transform: rotate(10deg); }
}

@keyframes tilt {
    0% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
    100% { transform: rotate(-5deg); }
}

@keyframes wave {
    0% { transform: rotate(20deg); }
    50% { transform: rotate(40deg); }
    100% { transform: rotate(20deg); }
}

@keyframes kick {
    0% { transform: rotate(10deg); }
    50% { transform: rotate(30deg); }
    100% { transform: rotate(10deg); }
}

@keyframes grip {
    0% { transform: scale(1); }
    50% { transform: scale(0.8); }
    100% { transform: scale(1); }
}

@keyframes tap {
    0% { transform: translateY(0); }
    50% { transform: translateY(5px); }
    100% { transform: translateY(0); }
}

@keyframes blink {
    0%, 90% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
    100% { transform: scaleY(1); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.robot {
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Portal effect */
.portal {
    position: absolute;
    width: 50px;
    height: 50px;
    background: radial-gradient(circle, #ff4500 10%, transparent 70%);
    border-radius: 50%;
    animation: portal-fade 1s forwards;
    z-index: -1;
}

@keyframes portal-fade {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* Gravity field effect */
#gravity-field {
    position: absolute;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: gravity-pulse 2s forwards;
    z-index: -1;
}

@keyframes gravity-pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Energy burst effect */
.energy-orb {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff4500;
    border-radius: 50%;
    animation: energy-burst 1s forwards;
    z-index: -1;
}

@keyframes energy-burst {
    0% { transform: translate(0, 0); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

/* Holographic projection */
#hologram {
    position: absolute;
    width: 10vw;
    height: 15vw;
    max-width: 100px;
    max-height: 150px;
    opacity: 0.5;
    filter: blur(2px) hue-rotate(180deg);
    pointer-events: none;
    z-index: 1;
}

#hologram .head, #hologram .body, #hologram .arms, #hologram .legs, #hologram .hand, #hologram .foot, #hologram .antenna {
    background: #00ffcc;
}

#hologram .eyes {
    background: #fff;
}

/* Dynamic lighting effect */
body::before {
    filter: url(#glow-filter);
}

.head, .eyes {
    filter: url(#glow-filter);
}

svg {
    position: absolute;
    width: 0;
    height: 0;
}

/* Microphone indicator */
.mic-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 30px;
    color: #00ffcc;
    opacity: 0.5;
    transition: opacity 0.3s ease, text-shadow 0.5s ease;
    z-index: 20;
}

.mic-indicator.listening {
    opacity: 1;
    text-shadow: 0 0 10px #00ffcc, 0 0 20px #00ffcc;
    animation: mic-pulse 1s infinite;
}

@keyframes mic-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Settings menu */
.settings-menu {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 20;
}

#settings-toggle {
    background: #1a1a3d;
    color: #00ffcc;
    border: 2px solid #ff4500;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 16px;
}

#settings-toggle:hover {
    background: #2a2a5d;
}

.settings-content {
    display: none;
    background: #1a1a3d;
    border: 2px solid #ff4500;
    border-radius: 5px;
    padding: 10px;
    margin-top: 5px;
    color: #fff;
    max-width: 300px;
}

.settings-content h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.settings-content label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

.settings-content select, .settings-content input {
    width: 100%;
    padding: 5px;
    margin-top: 2px;
    background: #2a2a5d;
    color: #fff;
    border: 1px solid #ff4500;
    border-radius: 3px;
}

.settings-content button {
    background: #ff4500;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 5px 10px;
    margin-top: 10px;
    cursor: pointer;
}

.settings-content button:hover {
    background: #e03e00;
}

#custom-commands-list {
    list-style: none;
    padding: 0;
    margin-top: 10px;
}

#custom-commands-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    background: #2a2a5d;
    margin-bottom: 5px;
    border-radius: 3px;
}

#custom-commands-list li button {
    background: #ff4500;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 2px 5px;
    cursor: pointer;
}

#custom-commands-list li button:hover {
    background: #e03e00;
}

#help-button {
    background: #00ffcc;
    color: #1a1a3d;
    border: none;
    border-radius: 3px;
    padding: 5px 10px;
    margin-top: 10px;
    cursor: pointer;
}

#help-button:hover {
    background: #00cc99;
}

.help-content {
    display: none;
    margin-top: 10px;
    background: #2a2a5d;
    border: 1px solid #ff4500;
    border-radius: 3px;
    padding: 10px;
}

.help-content h3 {
    margin: 0 0 5px;
    font-size: 14px;
}

.help-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-content li {
    padding: 5px 0;
    font-size: 12px;
}

@media (max-width: 600px) {
    .robot, #hologram {
        width: 15vw;
        height: 22.5vw;
        max-width: 80px;
        max-height: 120px;
    }
    .hand-control {
        width: 40px;
        height: 40px;
    }
    .hand-icon {
        font-size: 20px;
    }
    .left-control, .right-control {
        left: 10px;
        right: 10px;
    }
    .mic-indicator {
        top: 10px;
        right: 10px;
        font-size: 20px;
    }
    .settings-menu {
        top: 40px;
        right: 10px;
    }
    .settings-content {
        max-width: 200px;
    }
}

/* Hand controls */
.hand-control {
    position: fixed;
    width: 60px;
    height: 60px;
    background: rgba(0, 255, 204, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
}

.hand-control:hover {
    background: rgba(0, 255, 204, 0.5);
}

/* Position left controls vertically */
.left-control {
    left: 20px;
}

#left-start-stop { top: 20%; }
#left-toggle-head { top: 30%; }
#left-toggle-arms { top: 40%; }
#left-toggle-legs { top: 50%; }
#left-toggle-antenna { top: 60%; }
#left-toggle-music { top: 70%; }

/* Position right controls vertically */
.right-control {
    right: 20px;
}

#right-faster { top: 20%; }
#right-slower { top: 30%; }
#right-spin-head { top: 40%; }
#right-change-color { top: 50%; }
#right-move-direction { top: 60%; }
#right-time-warp { top: 70%; }

.hand-icon {
    font-size: 30px;
    color: #00ffcc;
}

.tooltip {
    position: absolute;
    top: -40px;
    background: #1a1a3d;
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    display: none;
    z-index: 20;
    border: 1px solid #ff4500;
}

.hand-control:hover .tooltip {
    display: block;
}

/* Customize the hamburger menu icon */
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 0.8)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Ensure the hamburger menu is only visible on mobile */
@media (min-width: 992px) {
    .navbar-toggler {
        display: none;
    }
}

/* Loading Indicator */
#loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1a1a3d;
    color: #00ffcc;
    padding: 15px 30px;
    border-radius: 10px;
    border: 2px solid #ff4500;
    box-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
    font-size: 18px;
    z-index: 1000;
    text-align: center;
}

/* Initially hide the robot until loading is complete */
#alien-robot {
    display: none;
}

/* Voice Command Feedback Animation */
.robot.voice-command-feedback {
    animation: voice-feedback 1s ease-in-out;
}

@keyframes voice-feedback {
    0% { box-shadow: 0 0 5px #00ffcc, 0 0 10px #00ffcc; }
    50% { box-shadow: 0 0 20px #00ffcc, 0 0 40px #00ffcc; }
    100% { box-shadow: 0 0 5px #00ffcc, 0 0 10px #00ffcc; }
}