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

body {
    font-family: 'Arial', sans-serif;
    background-color: #121212;
    color: white;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

.controls {
    padding: 10px;
    background-color: #1e1e1e;
    display: flex;
    flex-wrap: wrap;
    gap: 10px; 
    border-bottom: 2px solid #007bff;
    align-items: center; 
}

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

button {
    padding: 10px 18px; 
    border: none;
    border-radius: 5px;
    background-color: #3a3a3a; 
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); 
}

button:hover {
    background-color: #4a4a4a; 
    transform: translateY(-1px); 
}

button.active {
    background-color: #007bff; 
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5); 
}

#create.active {
    background-color: #28a745; 
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}
#draw-box.active {
    background-color: #ffc107; 
    color: #212529; 
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}
#gravity.active {
    background-color: #17a2b8; 
    box-shadow: 0 0 10px rgba(23, 162, 184, 0.5);
}
#clear {
    background-color: #dc3545; 
}
#clear:hover {
    background-color: #c82333;
}
#shop-btn {
    background-color: #6f42c1; 
    display: flex;
    align-items: center;
    gap: 5px;
}
#shop-btn:hover {
    background-color: #805ad5;
}

#shop-button-cash {
    font-weight: bold;
    color: #FFD700;
    margin-left: 3px;
    background-color: rgba(0,0,0,0.3);
    padding: 2px 5px;
    border-radius: 3px;
}

.slider-group {
    display: flex;
    gap: 15px; 
    align-items: center;
    flex-wrap: wrap;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-container label {
    font-weight: bold; 
    color: #e0e0e0; 
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 150px; 
    height: 10px; 
    background: #444; 
    border-radius: 5px;
    cursor: pointer;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px; 
    height: 20px; 
    background: #007bff; 
    border-radius: 50%;
    border: 2px solid white; 
    margin-top: -5px; 
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.7); 
    transition: background-color 0.2s ease-in-out;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #0056b3; 
}

input[type="range"]::-moz-range-thumb {
    width: 18px; 
    height: 18px; 
    background: #007bff; 
    border-radius: 50%;
    border: 2px solid white; 
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.7); 
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

input[type="range"]::-moz-range-thumb:hover {
    background: #0056b3; 
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 10px;
    background: #444;
    border-radius: 5px;
    cursor: pointer;
}

#size::-webkit-slider-thumb { background: #28a745; box-shadow: 0 0 5px rgba(40, 167, 69, 0.7); }
#size::-moz-range-thumb { background: #28a745; box-shadow: 0 0 5px rgba(40, 167, 69, 0.7); }

#bounce::-webkit-slider-thumb { background: #ffc107; box-shadow: 0 0 5px rgba(255, 193, 7, 0.7); }
#bounce::-moz-range-thumb { background: #ffc107; box-shadow: 0 0 5px rgba(255, 193, 7, 0.7); }

#force::-webkit-slider-thumb { background: #dc3545; box-shadow: 0 0 5px rgba(220, 53, 69, 0.7); }
#force::-moz-range-thumb { background: #dc3545; box-shadow: 0 0 5px rgba(220, 53, 69, 0.7); }

#void-radius::-webkit-slider-thumb { background: #6f42c1; box-shadow: 0 0 5px rgba(111, 66, 193, 0.7); }
#void-radius::-moz-range-thumb { background: #6f42c1; box-shadow: 0 0 5px rgba(111, 66, 193, 0.7); }

#volume::-webkit-slider-thumb { background: #00bcd4; box-shadow: 0 0 5px rgba(0, 188, 212, 0.7); }
#volume::-moz-range-thumb { background: #00bcd4; box-shadow: 0 0 5px rgba(0, 188, 212, 0.7); }

canvas {
    flex-grow: 1;
    background-color: #000;
    cursor: crosshair;
    touch-action: none; /* Prevent default touch behaviors like pinch-zoom */
}

.particle-count-display { 
    padding: 8px 12px;
    background-color: #3a3a3a; 
    color: white;
    border-radius: 5px;
    font-size: 0.9em; 
    display: flex;
    align-items: center;
    gap: 4px;
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch; 
    }
    
    .slider-container {
        width: 100%; 
        justify-content: space-between; 
    }
    .slider-container label {
        white-space: nowrap; 
        margin-right: 10px; 
    }
    input[type="range"] { 
        flex-grow: 1; 
        min-width: 120px; 
        width: auto; 
        max-width: none; 
    }
    .particle-count-display {
        justify-content: center; 
        padding: 10px; 
    }
}

.cash-display {
    position: absolute;
    top: 70px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.cash-icon {
    font-size: 18px;
}

.cash-earned {
    position: absolute;
    color: gold;
    font-weight: bold;
    font-size: 24px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    animation: float-up-and-scale 1.5s ease-out forwards;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    border: 2px solid gold;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    transform-origin: center;
}

@keyframes float-up-and-scale {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.5);
    }
    15% {
        opacity: 1;
        transform: translateY(0) scale(1.2);
    }
    30% {
        transform: translateY(-10px) scale(1);
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.8);
    }
}

.cash-particle {
    position: absolute;
    pointer-events: none;
    z-index: 999;
    font-size: 20px;
    animation: spin-and-float 1.5s ease-out forwards;
}

@keyframes spin-and-float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5) rotate(360deg);
    }
}

.void-effect {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.8);
    pointer-events: none;
    z-index: 10;
}

@keyframes rotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.fill-box-ui {
    position: absolute;
    background-color: rgba(30, 30, 30, 0.9);
    padding: 15px;
    border-radius: 8px;
    z-index: 200;
    display: none; 
    flex-direction: column;
    gap: 10px;
    align-items: center;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    color: white;
    font-size: 1.1em;
}

.fill-box-ui button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: bold; 
}

#fill-box-confirm {
    background-color: #007bff; 
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.5);
}

#fill-box-confirm:hover {
    background-color: #0056b3;
}

#fill-box-cancel {
    background-color: #dc3545; 
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.5);
}

#fill-box-cancel:hover {
    background-color: #c82333;
}

.tab {
    display: flex;
    border-bottom: 1px solid #333;
    margin-bottom: 20px;
}

.tablinks {
    flex: 1;
    background-color: #2d2d2d;
    border: none;
    padding: 10px 0;
    cursor: pointer;
    transition: 0.3s;
    font-weight: bold; 
}

.tablinks:hover {
    background-color: #3d3d3d;
}

.tablinks.active {
    background-color: #007bff; 
}

.tabcontent {
    display: none;
    padding: 15px 0;
}

.tabcontent.active {
    display: block;
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.shop-item {
    background-color: #2d2d2d;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s;
    cursor: pointer;
}

.shop-item:hover {
    transform: translateY(-5px);
}

.shop-item.purchased {
    border: 2px solid #4caf50;
}

.shop-item.selected {
    border: 2px solid #007bff;
}

.item-preview {
    width: 100%;
    height: 100px;
    border-radius: 5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px; 
    background-color: #383838; 
}

.item-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.item-price {
    display: flex;
    align-items: center;
    gap: 5px;
}

.buy-button {
    margin-top: 10px;
    padding: 5px 15px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold; 
}

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

.select-button {
    margin-top: 10px;
    padding: 5px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold; 
}

.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: 5% auto;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

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

.close:hover {
    color: white;
}

.shop-cash {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 5px 12px;
    border-radius: 15px;
}

.external-links {
    position: fixed;
    bottom: 10px;
    left: 10px;
    display: flex;
    flex-direction: column; 
    gap: 8px; 
    z-index: 1001; 
}

.external-link-button {
    padding: 6px 12px; 
    border-width: 2px;
    border-style: outset; 
    border-radius: 3px; 
    color: white; 
    cursor: pointer;
    transition: background-color 0.2s, border-style 0.2s, border-color 0.2s; 
    font-size: 13px; 
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-weight: bold; 
}

.external-link-button:hover {
    border-style: inset; 
}

#junk-pixel-link {
    background-color: #005cbf; 
    border-color: #005cbf; 
    color: white;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.4); 
}
#junk-pixel-link:hover {
    background-color: #004c99; 
    border-color: #004c99;
}

#buy-coffee-link {
    background-color: #d2b48c; 
    border-color: #d2b48c; 
    color: #3A2B1C; 
    text-shadow: 1px 1px 0px rgba(255,255,255,0.2); 
}

#buy-coffee-link:hover {
    background-color: #c1a37d; 
    border-color: #c1a37d;
}