body {
    margin: 0;
    overflow: hidden;
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('spacebackround3.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

canvas {
    display: block;
}

#controls {
    position: absolute;
    top: 10px;
    left: 10px;
    color: white;
    font-family: sans-serif;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#controls label {
    margin-right: 0;
}

#controls select,
#controls input[type="range"],
#controls button {
    padding: 3px;
    border-radius: 3px;
    background-color: #333;
    color: white;
    border: 1px solid #555;
    font-size: 14px;
}

#controls button {
     padding: 5px 10px;
     cursor: pointer;
}

/* Add specific style for the remove button */
#removeParticlesButton {
    background-color: #8B0000; /* Dark Red */
}

#removeParticlesButton:hover {
    background-color: #B22222; /* Firebrick */
}

#controls button:hover {
    background-color: #777;
}

#particleCount {
    font-size: 14px;
}

/* Specific style for the range input */
#controls input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    background: #555;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
    width: 100px;
}

#controls input[type="range"]:hover {
    opacity: 1;
}

/* Style for the slider thumb */
#controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    background: #fff;
    cursor: pointer;
    border-radius: 50%;
}

#controls input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: #fff;
    cursor: pointer;
    border-radius: 50%;
}

/* Styles for the Thank You message */
#thankYouMessage {
    position: absolute;
    top: auto;
    bottom: 10px;
    left: auto;
    right: 10px;
    color: white;
    font-family: 'Comic Sans MS', cursive, sans-serif; 
    font-size: 0.7em; 
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); 
    background-color: rgba(255, 105, 180, 0.7); 
    padding: 3px 6px; 
    border-radius: 10px; 
    border: 1px solid hotpink; 
    cursor: pointer;
    z-index: 100; 
    transition: transform 0.1s ease-in-out; 
}

#thankYouMessage:hover {
    background-color: rgba(255, 105, 180, 0.9);
}

#thankYouMessage:active {
     transform: scale(0.98); 
}

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

/* Basic animation (can be extended) */
@keyframes fall {
    to {
        transform: translateY(100vh) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

@keyframes swing {
    0% { transform: translateX(0); }
    50% { transform: translateX(50px); }
    100% { transform: translateX(0); }
}

/* Modal styles */
.modal {
    display: none; 
    position: fixed; 
    z-index: 100; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.8); 
    backdrop-filter: blur(5px); 
}

.modal-content {
    background-color: rgba(20, 20, 30, 0.95); 
    margin: 5% auto; 
    padding: 20px;
    border: 1px solid #888;
    width: 90%; 
    max-width: 700px; 
    border-radius: 8px;
    color: white;
    font-family: sans-serif;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative; 
    max-height: 85%; 
    overflow-y: auto; 
}

.modal-content h2 {
    margin-top: 0;
    color: #ADD8E6; 
}

.modal-content p {
    font-size: 0.9em;
    margin-bottom: 15px;
    color: #ccc;
}

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

.close-button:hover,
.close-button:focus {
    color: white;
    text-decoration: none;
}

#rulesTableContainer {
    margin-top: 15px;
    margin-bottom: 20px;
    overflow: auto; 
    max-height: 400px; 
}

#rulesTableContainer table {
    width: auto; 
    min-width: 100%; 
    border-collapse: collapse;
    table-layout: auto; 
}

#rulesTableContainer th,
#rulesTableContainer td {
    border: 1px solid #444;
    padding: 5px;
    text-align: center;
    font-size: 0.8em;
    min-width: 65px; 
}

#rulesTableContainer th {
    background-color: #333;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10; 
}

/* Sticky first column header */
#rulesTableContainer tbody tr th:first-child {
    position: sticky;
    left: 0;
    z-index: 9; 
    background-color: #333; 
    color: #fff;
}

/* Top-left corner cell (Affected/Affecting label) */
#rulesTableContainer thead tr:last-child th:first-child {
     position: sticky;
     top: 0;
     left: 0;
     z-index: 11; 
     background-color: #333; 
     color: #fff;
}

#rulesTableContainer td {
     background-color: #282828;
}

#rulesTableContainer input[type="number"] {
    width: 100%;
    padding: 3px;
    box-sizing: border-box; 
    background-color: #1e1e1e; 
    color: #eee;
    border: 1px solid #555;
    border-radius: 3px;
    font-size: 0.9em;
    text-align: center;
    -moz-appearance: textfield; 
    min-width: 50px; 
}

/* Hide spinner arrows for Webkit browsers (Chrome, Safari) */
#rulesTableContainer input[type="number"]::-webkit-outer-spin-button,
#rulesTableContainer input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Optional: Hover effect on cells for better visibility */
#rulesTableContainer td:hover {
    background-color: #3a3a3a;
}
#rulesTableContainer tbody tr th:first-child:hover {
     background-color: #3a3a3a; 
}

.modal-buttons {
    text-align: right;
    margin-top: 15px;
}

.modal-buttons button {
    padding: 8px 15px;
    margin-left: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

#saveRulesButton {
    background-color: #4CAF50; 
    color: white;
    border: none;
}

#saveRulesButton:hover {
    background-color: #45a049;
}

#cancelRulesButton {
    background-color: #f44336; 
    color: white;
    border: none;
}

#cancelRulesButton:hover {
    background-color: #da190b;
}