/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #e6e6e6;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

h1 {
    color: #f8bbd0;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(248, 187, 208, 0.5);
}

h3 {
    color: #80deea;
    font-size: 1.5rem;
    margin-top: 0;
}

p {
    max-width: 600px;
    line-height: 1.6;
    margin: 10px auto;
}

/* Rules Button Styles */
.rules-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(145deg, #4a148c, #7b1fa2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    z-index: 100;
}

.rules-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(145deg, #7b1fa2, #9c27b0);
}

/* Stats Button Styles */
.stats-button {
    position: fixed;
    top: 70px; /* Positioned below the rules button with some spacing */
    right: 20px;
    background: linear-gradient(145deg, #4a148c, #7b1fa2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    z-index: 100;
}

.stats-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(145deg, #7b1fa2, #9c27b0);
}

/* Rules Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 101;
    max-width: 80%;
    max-height: 80vh;
    overflow-y: auto;
    color: #e6e6e6;
}

.modal h3 {
    color: #f8bbd0;
    margin-top: 0;
    font-size: 1.8rem;
}

.modal p {
    margin-bottom: 15px;
    text-align: left;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #80deea;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
}

/* Overlay for when modal is open */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
}

/* Button Styles */
button {
    background: linear-gradient(145deg, #4a148c, #7b1fa2);
    color: white;
    border: none;
    padding: 12px 24px;
    margin: 10px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(145deg, #7b1fa2, #9c27b0);
}

button:active {
    transform: translateY(1px);
}

#start-button {
    background: linear-gradient(145deg, #2e7d32, #388e3c);
}

#start-button:hover {
    background: linear-gradient(145deg, #388e3c, #43a047);
}

#reset-button {
    background: linear-gradient(145deg, #c62828, #d32f2f);
}

#reset-button:hover {
    background: linear-gradient(145deg, #d32f2f, #e53935);
}

/* Input Styles */
.selector input {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 12px 20px;
    margin: 8px;
    color: #ffffff;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    width: 220px;
    text-align: center;
}

.selector input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.selector input:focus {
    border-color: #80deea;
    box-shadow: 0 0 12px rgba(128, 222, 234, 0.8);
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}


/* Level Container Styles */
#level-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin: 20px auto;
    max-width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

/* Reactor Button Styles */
.reactorfunction {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
}

.reactorfunction:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* Timer Styles */
#time {
    position: fixed;
    top: 20px;
    left: 20px;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    z-index: 100;
}

#time .digit {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 5px;
    min-width: 30px;
    text-align: center;
    margin: 0 2px;
}

#time .txt {
    margin: 0 2px;
    color: #80deea;
}

/* Reactor Number Colors */
.reactorfunction.\30 { /* 0 */
    background: rgba(76, 175, 80, 0.7); /* Green */
    color: #e8f5e9;
}
.reactorfunction.\31 { /* 1 */
    background: rgba(33, 150, 243, 0.7); /* Blue */
    color: #e3f2fd;
}
.reactorfunction.\32 { /* 2 */
    background: rgba(233, 30, 99, 0.7); /* Pink */
    color: #fce4ec;
}
.reactorfunction.\33 { /* 3 */
    background: rgba(255, 152, 0, 0.7); /* Orange */
    color: #fff3e0;
}
.reactorfunction.\34 { /* 4 */
    background: rgba(156, 39, 176, 0.7); /* Purple */
    color: #f3e5f5;
}
.reactorfunction.\35 { /* 5 */
    background: rgba(0, 188, 212, 0.7); /* Cyan */
    color: #e0f7fa;
}
.reactorfunction.\36 { /* 6 */
    background: rgba(244, 67, 54, 0.7); /* Red */
    color: #ffebee;
}
.reactorfunction.\37 { /* 7 */
    background: rgba(205, 220, 57, 0.7); /* Lime */
    color: #f9fbe7;
}
.reactorfunction.\38 { /* 8 */
    background: rgba(121, 85, 72, 0.7); /* Brown */
    color: #efebe9;
}
.reactorfunction.\39 { /* 9 */
    background: rgba(96, 125, 139, 0.7); /* Blue Grey */
    color: #eceff1;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .reactorfunction {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .rules-button {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .rules-modal {
        padding: 20px;
        max-width: 90%;
    }
}

/* Particles Background */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    pointer-events: none;
}