:root {
    --background-color: #1a1a1a;
    --text-color: #f0f0f0;
    --border-color: #555;
    --border-hover-color: #777;
    --drop-bg-hover: #333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 20s ease infinite;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding-top: 2rem;
    text-align: center;
}

h1 {
    margin-bottom: 1rem;
    font-size: 3rem;
    background-image: url('asset_name.png');
    background-size: cover;
    background-position: center;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    filter: hue-rotate(0deg);
    animation: color-cycle 10s linear infinite;
    text-shadow: 0px 0px 10px rgba(0,0,0,0.5);
}

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

@keyframes color-cycle {
    to {
        filter: hue-rotate(360deg);
    }
}

#drop-zone {
    width: 80%;
    max-width: 600px;
    height: 200px;
    border: 3px dashed var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

#drop-zone.dragover {
    background-color: var(--drop-bg-hover);
    border-color: var(--border-hover-color);
}

#drop-zone p {
    color: #aaa;
    pointer-events: none;
}

#video-container {
    position: relative; /* For overlay positioning */
    margin: 20px 0;
    width: 90%;
    max-width: 720px;
}

#video-player {
    width: 100%;
    border-radius: 10px;
    background-color: #000;
    transition: filter 0.2s ease-in-out, transform 0.3s ease-in-out;
}

#ytp-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

#ytp-overlay img {
    position: absolute;
    display: none; /* Hidden by default */
    max-width: 40%;
    max-height: 40%;
    animation: pop-in 0.3s ease-out forwards;
    transform-origin: center center;
}

#ytp-overlay .ytp-text {
    position: absolute;
    font-family: "Comic Sans MS", "Comic Sans", "Impact", "Arial Black", cursive, sans-serif;
    font-size: clamp(2rem, 8vw, 6rem);
    font-weight: 900;
    -webkit-text-stroke: 2px black;
    text-stroke: 2px black;
    text-shadow: 3px 3px 0 #000,
                 -1px -1px 0 #000,
                  1px -1px 0 #000,
                  -1px 1px 0 #000,
                   1px 1px 0 #000;
    animation: pop-in 0.3s ease-out forwards;
    transform-origin: center center;
    white-space: nowrap;
}

@keyframes pop-in {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-30deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

#controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 720px;
    gap: 20px;
}

#effect-toggles {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

#slider-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

#length-control, #craziness-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-color);
}

#length-control input[type="range"],
#craziness-control input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 200px;
    height: 8px;
    background: #444;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

#length-control input[type="range"]::-webkit-slider-thumb,
#craziness-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #ff4b2b;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

#length-control input[type="range"]::-moz-range-thumb,
#craziness-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #ff4b2b;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

#length-control input[type="range"]:hover,
#craziness-control input[type="range"]:hover {
    background: #555;
}

#length-control input[type="range"]::-webkit-slider-thumb:hover,
#craziness-control input[type="range"]::-webkit-slider-thumb:hover {
    background: #ff6a50;
}

#length-control input[type="range"]::-moz-range-thumb:hover,
#craziness-control input[type="range"]::-moz-range-thumb:hover {
    background: #ff6a50;
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.toggle-option label {
    cursor: pointer;
    user-select: none;
}

.toggle-option input[type="checkbox"] {
    cursor: pointer;
    accent-color: #ff4b2b;
    width: 18px;
    height: 18px;
}

button {
    padding: 12px 24px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(45deg, #ff416c, #ff4b2b);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 75, 43, 0.5);
}

button:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.secondary-button {
    background: #444;
    border: 2px solid #666;
    margin-bottom: 1rem;
}

.secondary-button:hover {
    background: #555;
    border-color: #888;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(200, 200, 200, 0.2);
}

.small-button {
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: normal;
}

.hidden {
    display: none;
}

/* Help Button */
.help-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #444;
    color: var(--text-color);
    border: 2px solid var(--border-color);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1000;
}

.help-button:hover {
    background-color: #555;
    transform: scale(1.1);
    border-color: var(--border-hover-color);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--background-color);
    padding: 30px 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    text-align: left;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay:not(.hidden) .modal-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-color);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    color: #ff4b2b;
}

.modal-content ol {
    padding-left: 20px;
    list-style: decimal;
}

.modal-content li {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-content li:last-of-type {
    margin-bottom: 0;
}

.modal-content ul {
    margin-top: 10px;
    padding-left: 25px;
    list-style: disc;
}

.modal-content ul li {
    margin-bottom: 8px;
    font-size: 0.9em;
}

.modal-content b {
    color: #f0f0f0;
}

/* Image Customization Section */
#image-customization-details {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    background-color: rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

#image-customization-details summary {
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 5px;
    user-select: none;
}

#image-customization-details summary::marker,
#image-customization-details summary::-webkit-details-marker {
    color: #ff4b2b;
}

.custom-asset-controls {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

#image-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 15px;
    margin-top: 15px;
    padding-left: 5px;
}

.image-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.image-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s ease;
}

.image-option label:hover {
    transform: scale(1.05);
}

.image-option img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding: 5px;
    border: 1px solid transparent;
}

.image-option input[type="checkbox"] {
    display: none; /* Hide checkbox, label handles interaction */
}

.image-option input[type="checkbox"]:checked + label img {
    border: 1px solid #ff4b2b;
    box-shadow: 0 0 10px rgba(255, 75, 43, 0.5);
}

.image-option input[type="checkbox"]:checked + label span {
    color: #ff4b2b;
    font-weight: bold;
}