* {
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}
h1 {
    margin: 0 0 20px;
    font-size: 1.5rem;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
}
.drop-zone {
    border: 3px dashed #555;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: #7b68ee;
    background: rgba(123, 104, 238, 0.1);
}
.drop-zone p {
    margin: 0;
    color: #888;
}
.canvas-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.canvas-wrapper {
    background: repeating-conic-gradient(#333 0% 25%, #222 0% 50%) 50% / 16px 16px;
    border-radius: 8px;
    padding: 10px;
}
.canvas-wrapper h3 {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: #888;
}
canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}
.preview-row {
    display: none;
}
.preview-row.visible {
    display: flex;
}
#view3dContainer {
    display: none;
}
#view3dContainer.visible {
    display: block;
}
.view-section {
    background: #16213e;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.view-section h3 {
    margin: 0 0 10px;
    color: #4ecca3;
    font-size: 1rem;
}
#isometric-container canvas {
    image-rendering: pixelated;
    background: #0f0f23;
    border-radius: 8px;
}
#three-container {
    width: 300px;
    height: 300px;
    background: #0f0f23;
    border-radius: 8px;
    overflow: hidden;
}
.view-controls {
    margin-top: 10px;
    font-size: 0.8em;
    color: #666;
}
.controls {
    background: #252540;
    border-radius: 12px;
    padding: 20px;
    display: none;
}
.controls.visible {
    display: block;
}
.slider-group {
    margin-bottom: 15px;
}
.slider-group label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
}
.slider-group input[type="range"] {
    width: 100%;
    height: 12px;
    -webkit-appearance: none;
    background: #333;
    border-radius: 6px;
    outline: none;
}
.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    border: 2px solid #333;
}
.slider-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    border: 2px solid #333;
}
/* Colorful slider backgrounds */
#hue {
    background: linear-gradient(to right,
        hsl(0, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%));
}
#saturation {
    background: linear-gradient(to right,
        hsl(30, 0%, 50%),
        hsl(30, 50%, 50%),
        hsl(30, 100%, 50%));
}
#lightness {
    background: linear-gradient(to right,
        #000,
        hsl(30, 50%, 50%),
        #fff);
}
#contrast {
    background:
        linear-gradient(to right, rgba(128,128,128,1) 0%, rgba(128,128,128,0) 100%),
        repeating-conic-gradient(#000 0% 25%, #fff 0% 50%) 50% / 8px 8px;
}
#colorizeHue {
    background: linear-gradient(to right,
        hsl(0, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%));
}
#colorizeAmount {
    background: linear-gradient(to right,
        #888,
        hsl(30, 100%, 50%));
}
#targetHue {
    background: linear-gradient(to right,
        hsl(0, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%));
}
#hueRange {
    background: linear-gradient(to right,
        #555,
        #888);
}
#greyAmount {
    background: linear-gradient(to right,
        hsl(30, 100%, 50%),
        hsl(30, 0%, 50%));
}
/* Hex input styling */
.slider-with-input {
    display: flex;
    gap: 10px;
    align-items: center;
}
.slider-with-input input[type="range"] {
    flex: 1;
}
.hex-input {
    width: 80px;
    padding: 4px 8px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #333;
    color: #fff;
    font-family: monospace;
    font-size: 0.85rem;
}
.hex-input::placeholder {
    color: #666;
}
/* Collapsible section */
.collapsible-section {
    background: #16213e;
    border-radius: 12px;
    margin-bottom: 20px;
    display: none;
}
.collapsible-section.visible {
    display: block;
}
.collapsible-section summary {
    padding: 15px 20px;
    cursor: pointer;
    color: #4ecca3;
    font-weight: 500;
    user-select: none;
}
.collapsible-content {
    padding: 0 20px 20px;
}
.reference-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.ref-label {
    font-size: 0.85rem;
    color: #888;
}
.drop-zone-small {
    border: 2px dashed #444;
    border-radius: 8px;
    padding: 10px 15px;
    text-align: center;
    cursor: pointer;
    font-size: 0.8rem;
    color: #666;
    flex: 1;
    max-width: 200px;
}
.drop-zone-small:hover {
    border-color: #7b68ee;
    background: rgba(123, 104, 238, 0.05);
}
.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}
/* Distribution histograms */
.distributions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}
.distribution-section {
    background: #0f0f23;
    border-radius: 8px;
    padding: 15px;
}
.distribution-section h3 {
    margin: 0 0 10px;
    color: #888;
    font-size: 0.85rem;
}
.distribution-section canvas {
    display: block;
    background: #0f0f23;
    border-radius: 4px;
}
.histogram-legend {
    display: none;
    gap: 20px;
    justify-content: center;
    margin-top: 15px;
    font-size: 0.8rem;
    color: #888;
}
.histogram-legend.visible {
    display: flex;
}
.legend-item {
    display: flex;
    align-items: center;
}
.legend-filled {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: #4ecca3;
    margin-right: 5px;
}
.legend-outline {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid white;
    background: transparent;
    margin-right: 5px;
}
.ref-presets {
    display: flex;
    gap: 8px;
    align-items: center;
}
.ref-preset-icon {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s;
}
.ref-preset-icon:hover {
    border-color: #7b68ee;
}
.ref-preset-icon.selected {
    border-color: #4ecca3;
}
.buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.btn-primary {
    background: #7b68ee;
    color: white;
}
.btn-primary:hover {
    background: #6a5acd;
}
.btn-secondary {
    background: #444;
    color: white;
}
.btn-secondary:hover {
    background: #555;
}
.file-input {
    display: none;
}
.section-title {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px 0 10px;
    padding-top: 15px;
    border-top: 1px solid #333;
}
.section-title:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.main-content {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.left-column {
    flex: 1;
    min-width: 300px;
}
.right-column {
    flex: 1;
    min-width: 300px;
}
.preview-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: flex-start;
}
.png-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.url-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.url-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #444;
    border-radius: 8px;
    background: #252540;
    color: #fff;
    font-size: 0.9rem;
}
.url-input::placeholder {
    color: #666;
}
.url-input:focus {
    outline: none;
    border-color: #7b68ee;
}
