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

body {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #000;
    font-family: 'Arial', sans-serif;
    cursor: grab;
}

#container {
    width: 100%;
    height: 100%;
    position: relative;
}

#controls {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    z-index: 1000;
    max-width: 320px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-right: 10px;
}

.control-group {
    background: rgba(0, 0, 0, 0.6);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.control-header {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #0cf;
    border-bottom: 1px solid rgba(0, 204, 255, 0.2);
    padding-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slider-container {
    margin: 12px 0;
}

.slider-container label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    color: #ddd;
}

.slider-container label span {
    color: #0cf;
    font-weight: bold;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #222;
    outline: none;
    transition: background 0.3s;
}
input[type="range"]:hover {
    background: #333;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0cf;
    cursor: pointer;
    border: 2px solid #000;
    box-shadow: 0 0 5px rgba(0, 204, 255, 0.5);
    transition: transform 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #0cf;
    cursor: pointer;
    border: 2px solid #000;
    box-shadow: 0 0 5px rgba(0, 204, 255, 0.5);
}

.color-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.color-theme {
    width: 60px;
    height: 30px;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    border: 1px solid transparent;
}

.color-theme:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    border-color: rgba(0, 204, 255, 0.7);
}

.color-theme.active {
    outline: 2px solid #0cf;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 204, 255, 0.7);
}

.color-theme::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, var(--color1) 0%, var(--color2) 50%, var(--color1) 100%);
    left: 0;
    top: 0;
}

#info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: #ccc;
    font-size: 13px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-button {
    background: rgba(20, 20, 30, 0.7);
    border: 1px solid rgba(0, 204, 255, 0.3);
    color: white;
    border-radius: 25px;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-button:hover {
    background: rgba(0, 204, 255, 0.25);
    border-color: #0cf;
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.4);
}

.toggle-icon {
    width: 16px;
    height: 16px;
    position: relative;
}

.toggle-icon::before, .toggle-icon::after {
    content: "";
    position: absolute;
    background-color: #0cf;
    transition: transform 0.3s ease-in-out;
    border-radius: 1px;
}

.toggle-icon::before {
    width: 100%;
    height: 2.5px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.toggle-icon::after {
    width: 2.5px;
    height: 100%;
    top: 0;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
}

.toggle-button.closed .toggle-icon::after {
    transform: translateX(-50%) rotate(0deg);
}

.stats-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 204, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    width: 200px;
}

.change-shape-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    background: rgba(20, 20, 30, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: bold;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 204, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.change-shape-button:hover {
    background: rgba(0, 204, 255, 0.3);
    border-color: #0cf;
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 6px 18px rgba(0, 204, 255, 0.3);
}

.change-shape-button:active {
    transform: translateY(0px) scale(1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    background: rgba(0, 204, 255, 0.4);
}
.change-shape-button span::before {
    content: "✧ ";
    font-size: 1.2em;
    margin-right: 4px;
    color: #0cf;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.stat-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.stat-label {
    color: #aaa;
    margin-right: 10px;
}

.stat-value {
    color: #0cf;
    font-weight: bold;
    text-align: right;
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s;
}

#loading h1 {
    color: white;
    font-size: 32px;
    margin-bottom: 30px;
    text-align: center;
    letter-spacing: 2px;
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    0% { text-shadow: 0 0 5px rgba(0, 204, 255, 0.5), 0 0 10px rgba(0, 204, 255, 0.3); }
    100% { text-shadow: 0 0 20px rgba(0, 204, 255, 0.8), 0 0 30px rgba(255, 0, 170, 0.5), 0 0 40px rgba(0, 204, 255, 0.3); }
}

.loader-container {
    position: relative;
    width: 250px;
    height: 30px;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 204, 255, 0.3);
    overflow: hidden;
}

.loader-bar {
    height: 100%;
    width: 0%;
    border-radius: 15px;
    background: linear-gradient(90deg,
        rgba(0, 204, 255, 0.8) 0%,
        rgba(255, 0, 170, 0.8) 50%,
        rgba(0, 204, 255, 0.8) 100%);
    transition: width 0.2s;
    position: relative;
    background-size: 200% 100%;
    animation: gradientMove 3s linear infinite;
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.7), 0 0 25px rgba(255, 0, 170, 0.5);
}

@keyframes gradientMove {
    0% { background-position: 200% 0; }
    100% { background-position: 0 0; }
}

.cosmic-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sparkle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    opacity: 0;
}

@keyframes sparkle {
    0% { transform: scale(0) rotate(0deg); opacity: 0; }
    50% { transform: scale(1.5) rotate(180deg); opacity: 1; }
    100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

#controls::-webkit-scrollbar {
    width: 8px;
}
#controls::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
}
#controls::-webkit-scrollbar-thumb {
    background: #0cf;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.5);
}
#controls::-webkit-scrollbar-thumb:hover {
    background: #0af;
}