#tsd-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    background-color: #fff;
    padding: 25px;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.canvas-wrapper {
    flex: 0 0 400px;
    width: 100%; 
    max-width: 100%;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.05);
    touch-action: none; 
}

.canvas-container {
    max-width: 100%;
}

.controls {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group {
    width: 100%;
    display: flex; 
    flex-direction: column;
    margin-bottom: 5px;
}

.controls h3 { 
    margin-top: 0; 
    font-size: 1.4rem; 
    color: #333; 
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.controls label { 
    font-weight: 700; 
    font-size: 0.8rem; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
    color: #555; 
    margin-bottom: 8px; 
}

/* Swatches */
.tsd-color-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.swatch {
    width: 35px; height: 35px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
}

.swatch:hover { transform: scale(1.1); }

.swatch.active {
    transform: scale(1.15);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #3498db;
}

.swatch-custom-wrapper {
    width: 35px; height: 35px;
    border-radius: 50%;
    overflow: hidden; position: relative;
    border: 2px solid rgba(0,0,0,0.1);
    cursor: pointer;
    background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
}

.swatch-custom-wrapper input[type="color"] {
    position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%; opacity: 0; cursor: pointer;
}

.swatch-custom-wrapper .custom-icon {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px; color: white; font-weight: bold;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
    pointer-events: none;
}

/* Inputs Polish */
.controls input[type="text"], 
.controls select,
.controls textarea {
    width: 100%; 
    display: block;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #ddd; 
    border-radius: 6px;
    font-size: 0.95rem;
    background-color: #fafafa;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
    font-family: inherit;
}

.controls textarea { 
    resize: vertical; 
    min-height: 100px;
}

.controls input[type="text"]:focus,
.controls select:focus,
.controls textarea:focus {
    border-color: #3498db; 
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
    outline: none;
}

.controls input[type="color"]#text-color {
    -webkit-appearance: none; border: none;
    width: 50px; height: 42px; cursor: pointer;
    padding: 0; background: none; border-radius: 6px; overflow: hidden;
}
.controls input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.controls input[type="color"]::-webkit-color-swatch { border: 1px solid #ddd; border-radius: 6px; }

/* Buttons Polish */
button {
    width: 100%; padding: 12px;
    border: none; border-radius: 6px;
    font-weight: 600; cursor: pointer;
    transition: all 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

#add-text { background-color: #3498db; color: white; }
#add-text:hover { background-color: #2980b9; }

.btn-upload { background-color: #2ecc71; color: white; }
.btn-upload:hover { background-color: #27ae60; }

.btn-danger { background-color: #e74c3c; color: white; }
.btn-danger:hover { background-color: #c0392b; }

.btn-reset { background-color: #95a5a6; color: white; }
.btn-reset:hover { background-color: #7f8c8d; }

#btn-send-back, #btn-bring-front, #btn-center-h {
    background-color: #f8f9fa; color: #444; border: 1px solid #dcdcdc;
    font-size: 0.75rem; padding: 10px;
    box-shadow: none;
}
#btn-send-back:hover, #btn-bring-front:hover, #btn-center-h:hover {
    background-color: #e9ecef; border-color: #caced1;
}

hr { border: 0; border-top: 1px solid #eee; margin: 15px 0; }

@media (max-width: 768px) {
    #tsd-container { flex-direction: column; padding: 15px; }
    .canvas-wrapper { flex: 1; min-height: 400px; }
    .controls { min-width: 100%; }
}