.ist-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Top toolbar: settings + actions in a row */
.ist-toolbar {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.ist-toolbar .ist-section {
    flex: 1;
    min-width: 220px;
}

.ist-toolbar .ist-section:first-child {
    flex: 0 0 260px;
}

.ist-toolbar .ist-actions-wrap {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 140px;
}

.ist-section {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.ist-section h3 {
    font-size: 0.9em;
    color: #2c3e50;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ist-section h3 i {
    color: #3498db;
}

.ist-upload {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
}

.ist-upload:hover,
.ist-upload.dragover {
    border-color: #3498db;
    background: #f0f7ff;
}

.ist-upload i {
    font-size: 1.6em;
    color: #3498db;
    margin-bottom: 6px;
}

.ist-upload p {
    color: #666;
    font-size: 0.8em;
    margin: 0 0 4px;
}

.ist-hint {
    color: #999;
    font-size: 0.72em;
}

.ist-mode-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}

.ist-mode-tab {
    flex: 1;
    padding: 7px 3px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 0.75em;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.ist-mode-tab:hover {
    color: #334155;
}

.ist-mode-tab.active {
    background: #fff;
    color: #3498db;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ist-form-row {
    margin-bottom: 12px;
}

.ist-form-row label {
    display: block;
    font-size: 0.82em;
    color: #555;
    margin-bottom: 5px;
    font-weight: 500;
}

.ist-form-row input[type="range"] {
    width: 100%;
    margin-top: 4px;
}

.ist-color-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ist-color-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.65em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ist-color-btn.active {
    box-shadow: 0 0 0 2px #3498db;
}

.ist-align-options {
    display: flex;
    gap: 6px;
}

.ist-align-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85em;
    color: #64748b;
    transition: all 0.2s;
}

.ist-align-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

.ist-align-btn.active {
    border-color: #3498db;
    background: #eef2ff;
    color: #3498db;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
}

/* Thumbnails with sort controls */
.ist-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    margin-bottom: 16px;
    justify-content: center;
}

.ist-thumb-wrap {
    position: relative;
    width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    background: #fff;
    border-radius: 10px;
    border: 2px solid #eee;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
}

.ist-thumb-wrap:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52,152,219,0.1);
}

.ist-thumb-wrap.dragging {
    opacity: 0.5;
    cursor: grabbing;
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52,152,219,0.2);
}

.ist-thumb-wrap.drag-over {
    border-color: #27ae60;
    border-style: dashed;
}

.ist-thumb-item {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    pointer-events: none;
}

.ist-thumb-idx {
    position: absolute;
    top: 4px;
    left: 4px;
    background: #3498db;
    color: #fff;
    font-size: 0.7em;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ist-thumb-actions {
    display: flex;
    gap: 3px;
    width: 100%;
    justify-content: center;
}

.ist-thumb-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.7em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.ist-thumb-btn:hover {
    background: #3498db;
    color: #fff;
}

.ist-thumb-btn.delete:hover {
    background: #e74c3c;
    color: #fff;
}

.ist-thumb-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ist-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ist-btn {
    flex: 1;
    min-width: 70px;
    padding: 9px;
    border: none;
    border-radius: 8px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.ist-btn-primary {
    background: #3498db;
    color: #fff;
}

.ist-btn-primary:hover:not(:disabled) {
    background: #2980b9;
}

.ist-btn-success {
    background: #27ae60;
    color: #fff;
}

.ist-btn-success:hover:not(:disabled) {
    background: #219a52;
}

.ist-btn-outline {
    background: #fff;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.ist-btn-outline:hover:not(:disabled) {
    background: #fef2f2;
}

.ist-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ist-usage-info {
    background: #e8f4fd;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.8em;
    color: #2c3e50;
    text-align: center;
}

.ist-usage-info i {
    color: #3498db;
    margin-right: 4px;
}

.ist-vip-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: rgba(0,0,0,0.75);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    backdrop-filter: blur(2px);
}

.ist-vip-mask-inner {
    text-align: center;
    color: #fff;
    padding: 30px;
}

.ist-vip-mask-icon {
    font-size: 3em;
    margin-bottom: 12px;
}

.ist-vip-mask-title {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 8px;
}

.ist-vip-mask-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.ist-vip-btn {
    background: #3498db;
    color: #fff;
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.ist-vip-btn:hover {
    background: #2980b9;
}

.ist-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}

.ist-preview-area {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ist-result-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    overflow: auto;
    max-height: 600px;
}

.ist-placeholder {
    text-align: center;
    color: #999;
}

.ist-placeholder i {
    font-size: 3em;
    margin-bottom: 12px;
    color: #bdc3c7;
}

.ist-placeholder p {
    margin: 0;
}

.ist-tips {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.ist-tips h4 {
    font-size: 0.95em;
    color: #2c3e50;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ist-tips h4 i {
    color: #f39c12;
}

.ist-tip-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.ist-tip-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    border-left: 3px solid #3498db;
}

.ist-tip-item strong {
    display: block;
    font-size: 0.85em;
    color: #2c3e50;
    margin-bottom: 3px;
}

.ist-tip-item p {
    font-size: 0.75em;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .ist-toolbar {
        flex-direction: column;
    }
    .ist-toolbar .ist-section,
    .ist-toolbar .ist-actions-wrap {
        flex: 1 1 100% !important;
        min-width: auto !important;
    }
    .ist-tip-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ist-thumb-wrap {
        width: 85px;
    }
    .ist-thumb-item {
        width: 65px;
        height: 65px;
    }
}

@media (max-width: 480px) {
    .ist-tip-grid {
        grid-template-columns: 1fr;
    }
    .ist-thumb-wrap {
        width: 75px;
        padding: 4px;
    }
    .ist-thumb-item {
        width: 55px;
        height: 55px;
    }
}
