* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #121212;
    color: #e0e0e0;
    line-height: 1.6;
}

body.rainbow-mode {
    background: linear-gradient(45deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    background-size: 400% 400%;
    animation: rainbow-bg 3s ease infinite;
}

@keyframes rainbow-bg {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body.rainbow-mode .container {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

body.rainbow-mode h1,
body.rainbow-mode h2,
body.rainbow-mode h3 {
    background: linear-gradient(45deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow-text 2s ease infinite;
}

@keyframes rainbow-text {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #bb86fc;
}

h2 {
    color: #03dac6;
    margin-top: 20px;
    margin-bottom: 10px;
}

h3 {
    color: #03dac6;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.header-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    position: relative;
}

.reset-btn {
    background-color: #cf6679;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
    position: absolute;
    right: 0;
}

.reset-btn:hover {
    background-color: #df7689;
}

.composer-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
    background: #1e1e1e;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.editor-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#expression {
    width: 100%;
    height: 100px;
    background-color: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    font-family: monospace;
    font-size: 16px;
    resize: vertical;
}

.formula-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

.formula-btn {
    background-color: #333;
    color: #e0e0e0;
    border: 1px solid #555;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.85rem;
}

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

.random-generator {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #444;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#random-formula-btn,
#spice-up-formula-btn {
    background-color: #6200ee;
    color: #ffffff;
    padding: 8px 15px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: bold;
    width: 100%;
}

#random-formula-btn:hover,
#spice-up-formula-btn:hover {
    background-color: #7722ff;
}

#spice-up-formula-btn {
    background-color: #03dac6;
    color: #000;
}

#spice-up-formula-btn:hover {
    background-color: #29e6d9;
}

.credit-text {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    text-align: center;
    font-style: italic;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    cursor: pointer;
}

.control-group input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

select, button {
    padding: 8px 15px;
    border-radius: 4px;
    border: none;
    font-size: 14px;
    cursor: pointer;
}

select {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #444;
}

button {
    background-color: #bb86fc;
    color: #000;
    font-weight: bold;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #c599fc;
}

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

#stop-button {
    background-color: #cf6679;
}

#stop-button:hover {
    background-color: #df7689;
}

.visualization {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
}

canvas {
    width: 100%;
    height: 150px;
    background-color: #2d2d2d;
    border-radius: 4px;
}

.info-section {
    background: #1e1e1e;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

p {
    margin-bottom: 15px;
}

ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.tab-container {
    display: flex;
    margin-bottom: 20px;
}

.tab-button {
    padding: 10px 20px;
    background-color: #333;
    color: #e0e0e0;
    border: none;
    border-radius: 4px 4px 0 0;
    margin-right: 5px;
    cursor: pointer;
    font-weight: bold;
}

.tab-button.active {
    background-color: #bb86fc;
    color: #121212;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.community-section {
    background: #1e1e1e;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.community-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#search-input {
    flex: 1;
    padding: 8px 15px;
    border-radius: 4px;
    border: 1px solid #444;
    background-color: #2d2d2d;
    color: #e0e0e0;
    font-size: 14px;
}

.bytebeat-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bytebeat-card {
    background-color: #2d2d2d;
    border-radius: 8px;
    padding: 15px;
    transition: transform 0.2s;
}

.bytebeat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.bytebeat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.bytebeat-title {
    font-size: 18px;
    color: #03dac6;
    margin: 0;
}

.bytebeat-author {
    font-size: 14px;
    color: #bb86fc;
    margin: 5px 0;
}

.bytebeat-description {
    color: #e0e0e0;
    margin-bottom: 15px;
    font-size: 14px;
}

.bytebeat-formula {
    background-color: #1e1e1e;
    border-radius: 4px;
    padding: 10px;
    font-family: monospace;
    overflow-x: auto;
    margin-bottom: 15px;
}

.bytebeat-actions {
    display: flex;
    gap: 10px;
}

.bytebeat-actions button {
    padding: 5px 10px;
    font-size: 12px;
}

.loading-text {
    text-align: center;
    color: #888;
    font-style: italic;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: #1e1e1e;
    margin: 10% auto;
    padding: 25px;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover {
    color: #e0e0e0;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #e0e0e0;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #444;
    background-color: #2d2d2d;
    color: #e0e0e0;
    font-size: 14px;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

#intro-cutscene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 1.5s ease-out;
}

.cutscene-content {
    text-align: center;
}

.glitch-text {
    font-size: 4rem;
    color: #bb86fc;
    text-shadow: 0 0 10px rgba(187, 134, 252, 0.7);
    animation: glitch 2s linear infinite;
    position: relative;
}

@keyframes glitch {
    0% {
        text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75), -0.05em -0.025em 0 rgba(0, 255, 0, 0.75), -0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
        transform: translate(0);
    }
    14% {
        text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75), -0.05em -0.025em 0 rgba(0, 255, 0, 0.75), -0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
        transform: translate(2px, 0);
    }
    15% {
        text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75), 0.025em 0.025em 0 rgba(0, 255, 0, 0.75), -0.05em -0.05em 0 rgba(0, 0, 255, 0.75);
        transform: translate(-2px, 0);
    }
    49% {
        text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75), 0.025em 0.025em 0 rgba(0, 255, 0, 0.75), -0.05em -0.05em 0 rgba(0, 0, 255, 0.75);
        transform: translate(1px, 0);
    }
    50% {
        text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75), 0.05em 0 0 rgba(0, 255, 0, 0.75), 0 -0.05em 0 rgba(0, 0, 255, 0.75);
        transform: translate(-1px, 0);
    }
    99% {
        text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75), 0.05em 0 0 rgba(0, 255, 0, 0.75), 0 -0.05em 0 rgba(0, 0, 255, 0.75);
        transform: translate(2px, 0);
    }
    100% {
        text-shadow: -0.025em 0 0 rgba(255, 0, 0, 0.75), -0.025em -0.025em 0 rgba(0, 255, 0, 0.75), -0.025em -0.05em 0 rgba(0, 0, 255, 0.75);
        transform: translate(0);
    }
}

.bytebeat-animation {
    width: 300px;
    height: 100px;
    margin: 30px auto 0;
    background-color: #2d2d2d;
    overflow: hidden;
    position: relative;
}

.bytebeat-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 300px;
    height: 100px;
    background: linear-gradient(90deg, transparent, #bb86fc, transparent);
    animation: wave 3s ease-in-out infinite;
}

@keyframes wave {
    0% {
        height: 50px;
        transform: translateY(25px) scaleY(0.5);
    }
    25% {
        height: 80px;
        transform: translateY(10px) scaleY(0.8);
    }
    50% {
        height: 30px;
        transform: translateY(35px) scaleY(0.3);
    }
    75% {
        height: 70px;
        transform: translateY(15px) scaleY(0.7);
    }
    100% {
        height: 50px;
        transform: translateY(25px) scaleY(0.5);
    }
}

.bytebeat-creator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0 10px 0;
}

.creator-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.formula-info {
    background-color: #2d2d2d;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    border-left: 3px solid #bb86fc;
}

.formula-info strong {
    color: #03dac6;
    display: block;
    margin-bottom: 5px;
}

.formula-info p {
    color: #e0e0e0;
    margin: 0;
    font-size: 14px;
}

/* Confetti styles */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    pointer-events: none;
    z-index: 10000;
}

.confetti:before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    animation: confetti-fall 3s linear infinite;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.achievement-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #bb86fc, #03dac6);
    color: #000;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    transform: translateX(400px);
    transition: transform 0.5s ease-out;
    max-width: 300px;
}

.achievement-popup.show {
    transform: translateX(0);
}

.achievement-content h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: bold;
}

.achievement-content h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: bold;
}

.achievement-content p {
    margin: 0;
    font-size: 12px;
    opacity: 0.8;
}

.reboot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    animation: reboot-fade 2s ease-out;
}

@keyframes reboot-fade {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.reboot-content {
    text-align: center;
    color: #bb86fc;
}

.reboot-content h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(187, 134, 252, 0.7);
}

.reboot-animation {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    border: 4px solid #333;
    border-top: 4px solid #bb86fc;
    border-radius: 50%;
    animation: reboot-spin 1s linear infinite;
}

@keyframes reboot-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.achievements-section {
    background: #1e1e1e;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

#achievements-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.achievement-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: #2d2d2d;
    border-radius: 8px;
    padding: 15px;
    transition: transform 0.2s;
}

.achievement-card.unlocked {
    background: linear-gradient(135deg, rgba(187, 134, 252, 0.1), rgba(3, 218, 198, 0.1));
    border: 1px solid rgba(187, 134, 252, 0.3);
}

.achievement-card.locked {
    opacity: 0.5;
}

.achievement-card:hover {
    transform: translateY(-2px);
}

.achievement-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
}

.achievement-info h3 {
    margin: 0 0 5px 0;
    color: #03dac6;
    font-size: 16px;
}

.achievement-info p {
    margin: 0;
    color: #e0e0e0;
    font-size: 14px;
}

@media (max-width: 768px) {
    .composer-section {
        flex-direction: column;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        justify-content: space-between;
    }
}