body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #0a0a0a;
    color: #fff;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.ui-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    padding-top: 10vh;
    text-shadow: 0 0 10px rgba(0,0,0,0.7);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ui-container.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

#effect-description {
    font-style: italic;
    color: #ccc;
    margin-top: 0;
    height: 1.2em; /* Reserve space to prevent layout shift */
    min-height: 1.2em;
}

#prompt-form {
    display: flex;
    margin-top: 1rem;
    width: 100%;
    max-width: 500px;
    position: relative;
}

#shape-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 0;
}

.shape-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    font-weight: bold;
}

.shape-btn:hover {
    background-color: #444;
    border-color: #777;
}

.shape-btn.active {
    background-color: #007bff;
    border-color: #007bff;
}

#prompt-input {
    flex-grow: 1;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #444;
    border-radius: 8px 0 0 8px;
    background-color: #222;
    color: #fff;
    outline: none;
}

#prompt-input:focus {
    border-color: #007bff;
}

button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 0 8px 8px 0;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background-color: #0056b3;
}

button:active {
    background-color: #004494;
    transform: scale(0.98);
}

button:disabled {
    background-color: #555;
    cursor: not-allowed;
}

.controls-panel {
    margin-top: 2rem;
    width: 100%;
    max-width: 500px;
    transition: max-height 0.3s ease-out, opacity 0.3s ease;
    overflow: hidden;
}

.controls-panel.hidden {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.control-section {
    margin-bottom: 0.5rem;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    background-color: #1a1a1a;
}

.section-toggle {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #222;
    border: none;
    color: #ccc;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.section-toggle:hover {
    background-color: #333;
}

.chevron {
    transition: transform 0.2s;
    font-size: 0.8rem;
}

.section-toggle.collapsed .chevron {
    transform: rotate(-90deg);
}

.section-content {
    padding: 1rem;
    transition: max-height 0.3s ease-out;
    overflow: hidden;
}

.section-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.control-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.control-group label {
    font-weight: bold;
    color: #ccc;
}

input[type="range"] {
    width: 100px;
    cursor: pointer;
}

#speed-value,
#size-value {
    font-family: monospace;
    color: #007bff;
    font-size: 0.9rem;
}

.toggle-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 60px;
}

.toggle-btn:hover {
    background-color: #444;
}

.toggle-btn.active {
    background-color: #007bff;
    border-color: #007bff;
}

.preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.preset-btn {
    padding: 0.75rem;
    font-size: 0.9rem;
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    font-weight: bold;
}

.preset-btn:hover {
    background-color: #444;
    border-color: #777;
}

#trail-value {
    font-family: monospace;
    color: #007bff;
    font-size: 0.9rem;
}

#extra-controls {
    display: none;
}

.ui-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(0, 123, 255, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-toggle-btn:hover {
    background-color: rgba(0, 123, 255, 1);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.ui-toggle-btn:active {
    transform: scale(0.95);
}