:root {
    --bg-color: #0f0f0f;
    --card-bg: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #646cff;
    --accent-hover: #747bff;
    --border-color: #2a2a2a;
    --input-bg: #2a2a2a;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
        sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-color);
    min-height: 100vh;
}

.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: 2rem;
}

header {
    text-align: center;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.title {
    text-align: center;
    justify-content: center;
    align-items: center;
    display: flex;
    gap: 1rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

main {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    flex: 1;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.controls-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.drag-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drag-area:hover {
    border-color: var(--accent);
}

.drag-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.drag-content svg {
    stroke: var(--text-secondary);
}

.control-groups {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px dotted var(--border-color);
    padding: 1rem;
    border-radius: 6px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: var(--input-bg);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--accent-hover);
}

.value {
    min-width: 3ch;
    color: var(--text-secondary);
}

.text-input {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 1rem;
}

.text-input:focus {
    border-color: var(--accent);
    outline: none;
}

.toggles {
    display: flex;
    gap: 1rem;
}

.toggle {
    flex-direction: row;
    align-items: center;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-label {
    position: relative;
    padding-left: 50px;
    user-select: none;
}

.toggle-label:before {
    content: "";
    position: absolute;
    left: 0;
    width: 40px;
    height: 22px;
    background: var(--input-bg);
    border-radius: 11px;
    transition: all 0.3s ease;
}

.toggle-label:after {
    content: "";
    position: absolute;
    left: 2px;
    top: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle input:checked + .toggle-label:before {
    background: var(--accent);
}

.toggle input:checked + .toggle-label:after {
    left: 20px;
    background: white;
}

.buttons {
    display: flex;
    gap: 1rem;
}

button {
    flex: 1;
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

button:hover {
    background: #333;
}

button.primary {
    background: var(--accent);
    border: none;
}

button.primary:hover {
    background: var(--accent-hover);
}

.output-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#outputCanvas {
    max-width: 100%;
    max-height: 80vh;
}

.select-input {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
    outline: none;
}

.select-input:focus {
    border-color: var(--accent);
}

.color-pickers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.color-pickers label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

input[type="color"] {
    -webkit-appearance: none;
    width: 100%;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sigma-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
    display: none; /* hidden by default */
}

.sigma-controls.active {
    display: flex;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }

    .app {
        padding: 1rem;
    }
}
