.controls {
    display: flex;
    gap: 12px;
}

button {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: .2s;
    background: var(--accent);
    border: none;
    color: #fff;
}

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

button.disabled {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    opacity: .6;
    cursor: not-allowed;
}

/* #region Advanced settings */
.advanced {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s, padding 0.3s;
    opacity: 0;
    padding: 0 20px;
}

.advanced.show {
    max-height: 2000px;
    opacity: 1;
    padding: 20px;
}

.advanced-title {
    align-items: center;
    background: #1f2129;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 16px;
    margin-bottom: 10px;
    position: relative;
    transition: background 0.2s;
    text-align: center;
}

.advanced-row {
    display: flex;
    align-items: center;
    background: #1f2129;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 16px;
    margin-bottom: 10px;
    position: relative;
    transition: background 0.2s;
}

.advanced-row:hover {
    background: rgba(79, 124, 255, 0.15);
}

.adv-brushes-settings {
    padding: 12px 0;
}

.adv-brush-settings {
    padding: 4px 0;
}

.advanced-setting-title {
    font-weight: 500;
    cursor: help;
    flex: 1;
    position: relative;
}

.adv-tooltip {
    display: none;
    position: absolute;
    top: 110%;
    left: 0;
    background: rgba(32, 35, 42, 0.95);
    color: #e6e8ee;
    padding: 8px;
    border-radius: 8px;
    font-size: 13px;
    width: 300px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.advanced-setting-title:hover .adv-tooltip {
    display: block;
}

.adv-input-span {
    display: flex;
    align-items: center;
}

.adv-input {
    width: 120px;
    padding: 10px 12px;
    border-radius: 8px;
    border: none;
    background: #181b22;
    color: #e6e8ee;
    font-size: 16px;
    text-align: right;
}

.adv-input:focus {
    outline: 2px solid var(--accent);
}

/* hide native checkbox */
.adv-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    background: #2a2d38;
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease;
}

/* knob */
.adv-toggle::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #9aa0b4;
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}

/* checked state */
.adv-toggle:checked {
    background: var(--accent);
}

.adv-toggle:checked::before {
    transform: translateX(20px);
    background: white;
}

/* focus (keyboard accessibility) */
.adv-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.unit {
    margin-left: 6px;
    width: 20px;
    color: #9aa0b4;
}

#advancedControls {
    flex-direction: row;
    justify-content: center;
}

#advancedControls > * {
    flex: max-content;
}

/* #endregion */

.upload {
    display: flex;
    align-items: center;
    justify-content: center;

    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    color: var(--muted);
    margin-bottom: 16px;
    transition: .2s;
}

.upload:hover {
    border-color: var(--accent);
    background: rgba(79, 124, 255, .1);
    color: #fff;
}

.upload input {
    display: none;
}

#dropOverlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 21, .6);
    backdrop-filter: blur(6px);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
}

#dropOverlay.active {
    display: flex;
}

.dropHint {
    width: 95vw;
    height: 95vh;
    border: 3px dashed var(--accent);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--text);
    background: rgba(79, 124, 255, .08);
}

.progress-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

progress {
    width: 100%;
    margin-top: 10px;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
}

progress::-webkit-progress-bar {
    background: var(--border);
}

progress::-webkit-progress-value {
    background: linear-gradient(90deg, var(--accent), #8aa3ff);
}

#canvas-wrap {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
}

canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

@media (max-width: 768px) {

    #advancedControls,
    .controls {
        flex-direction: column;
        gap: 12px;
    }

    .progress {
        font-size: 15px;
    }

    .advanced {
        padding: 12px;
    }

    .advanced-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .advanced-setting-title {
        font-size: 15px;
    }

    .adv-input-span {
        width: 100%;
    }

    .adv-input {
        width: 100%;
        font-size: 16px;
        padding: 12px;
    }

    .unit {
        font-size: 14px;
    }
}
