*, *::before, *::after {
box-sizing: border-box;
}
body {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
margin: 0;
background: #1e293b;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.battery-wrapper {
display: flex;
flex-direction: column;
align-items: center;
}
.battery-terminal {
width: 40px;
height: 16px;
background: #475569;
border-radius: 6px 6px 0 0;
}
.battery-body {
position: relative;
width: 140px;
height: 260px;
border: 4px solid #475569;
border-radius: 16px;
background: #0f172a;
overflow: hidden;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
display: flex;
justify-content: center;
align-items: center;
}
.charge-liquid {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 0%;
background: #ef4444;
/* Animate height and color securely over 8 seconds */
animation: fill-battery 8s ease-in-out infinite;
}
.charge-liquid::before {
content: "";
position: absolute;
top: -10px;
left: -50%;
width: 200%;
height: 20px;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
animation: wave-horizontal 2s infinite linear;
}
@keyframes fill-battery {
0% { height: 5%; background: #ef4444; box-shadow: 0 0 20px #ef4444; }
30% { background: #f59e0b; box-shadow: 0 0 20px #f59e0b; }
70% { background: #10b981; box-shadow: 0 0 20px #10b981; }
100% { height: 95%; background: #10b981; box-shadow: 0 0 30px #10b981; }
}
@keyframes wave-horizontal {
0% { transform: translateX(0); }
100% { transform: translateX(25%); }
}
.charge-text {
position: relative;
z-index: 10;
color: #ffffff;
font-weight: 800;
letter-spacing: 2px;
text-transform: uppercase;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}